0
蔭試圖驗證AP驗證:對話框如下忽略對話框關閉JSF primefaces
<p:dialog widgetVar="canPolDialog" id="canPolDialog" modal="true"
appendTo="@form:canPolPanel"
focus="name"
resizable="false" draggable="false" minHeight="600" minWidth="250" width="700"
onHide="hideModal()" styleClass="canPolDialog">
<f:facet name="header">
<div class="dialogHeader">
<h2>#{messages['pages.cancellationPolicies.dialog.title']}</h2>
<span>#{messages['pages.cancellationPolicies.dialog.description']}</span>
</div>
</f:facet>
<p:outputPanel id="cancellationDetail"
styleClass="col-md-12 xs-mt-20 dialogSublabel">
<f:validateBean>
<p:outputPanel rendered="#{policyBean.renderCancelationDialog}">
<p:outputPanel id="customPanel">
<f:verbatim escape="false"
rendered="#{policyBean.closePopup}">
<script type="text/javascript">
PF('canPolDialog').hide();
</script>
</f:verbatim>
<div class="row">
<ets:inputTextWithLabel
label="pages.cancellationPolicies.name"
id="name"
formCol="6"
requiredMessage="#{readMessage.getValidationMessagesValue('cancellationPolcy.policyName.cant.be.null')}"
value="#{policyBean.cancelationPolicyPojo.name}"
required="true"
/>
</div>
<div class="col-md-10 minsizeText">
#{messages['pages.cancellationPolicies.policyName.description']}
</div>
<div class="row">
<ets:selectWithLabel required="true"
id="policyNameType"
requiredMessage="#{readMessage.getValidationMessagesValue('cancellationPolcy.policyNameType.cant.be.null')}"
firstItem="#{messages['global.pleaseSelect']}"
formCol="6"
label="pages.cancellationPolicies.policyName"
value="#{policyBean.cancelationPolicyPojo.policyNameType}">
<f:selectItems noSelectionValue="false"
value="#{PolicyNameType.values()}"
var="nameType"
itemValue="#{nameType}"
itemLabel="#{messages[nameType.getBundleKey()]}"/>
<p:ajax event="change" resetValues="true"
update="@form:cancellationTypePanel,@form:dropdownHour,@form:penaltyRenderArea,@form:noShowPanel"
listener="#{policyBean.onNameTypeChange()}"/>
</ets:selectWithLabel>
</div>
<div class="col-md-10 minsizeText">
#{messages['pages.cancellationPolicies.acceptCancelation.description']}
</div>
<div class="row">
<p:outputPanel id="cancellationTypePanel">
<ets:selectWithLabel
id="cancellationType"
firstItem="#{messages['global.pleaseSelect']}"
formCol="6" required="true"
requiredMessage="#{readMessage.getValidationMessagesValue('cancellationPolicy.canType.cant.be.null')}"
label="pages.cancellationPolicies.acceptCancelation"
value="#{policyBean.cancelationPolicyPojo.cancellationType}">
<f:selectItems
value="#{policyBean.cancellationTypes}"
var="var" noSelectionValue="false"
itemValue="#{var}"
itemLabel="#{messages['cancelationPolicyBean.cancelationPolicyPojo.'.concat(var.friendlyName())]}"
/>
<p:ajax resetValues="true" event="change"
listener="#{policyBean.handleCancellationChange}"
update="@form:dropdownHour,@form:penaltyRenderArea"/>
</ets:selectWithLabel>
</p:outputPanel>
<p:outputPanel id="dropdownHour">
<p:outputPanel
rendered="#{policyBean.renderSameDayCanpolOpt}">
<ets:selectWithLabel
id="cancellationValue"
value="#{policyBean.cancelationPolicyPojo.cancellationValue}"
formCol="6" required="true"
requiredMessage="#{messages['pages.cancellationPolicies.pleaseSelectHour']}"
label="pages.cancellationPolicies.sameday">
<f:selectItem itemLabel="00:00"
itemValue="00:00"/>
<f:selectItem itemLabel="01:00"
itemValue="01:00"/>
<f:selectItem itemLabel="02:00"
itemValue="02:00"/>
<f:selectItem itemLabel="03:00"
itemValue="03:00"/>
<f:selectItem itemLabel="04:00"
itemValue="04:00"/>
<f:selectItem itemLabel="05:00"
itemValue="05:00"/>
<f:selectItem itemLabel="06:00"
itemValue="06:00"/>
<f:selectItem itemLabel="07:00"
itemValue="07:00"/>
<f:selectItem itemLabel="08:00"
itemValue="08:00"/>
<f:selectItem itemLabel="09:00"
itemValue="09:00"/>
<f:selectItem itemLabel="10:00"
itemValue="10:00"/>
<f:selectItem itemLabel="11:00"
itemValue="11:00"/>
<f:selectItem itemLabel="12:00"
itemValue="12:00"/>
<f:selectItem itemLabel="13:00"
itemValue="13:00"/>
<f:selectItem itemLabel="14:00"
itemValue="14:00"/>
<f:selectItem itemLabel="15:00"
itemValue="15:00"/>
<f:selectItem itemLabel="16:00"
itemValue="16:00"/>
<f:selectItem itemLabel="17:00"
itemValue="17:00"/>
<f:selectItem itemLabel="18:00"
itemValue="18:00"/>
<f:selectItem itemLabel="19:00"
itemValue="19:00"/>
<f:selectItem itemLabel="20:00"
itemValue="20:00"/>
<f:selectItem itemLabel="21:00"
itemValue="21:00"/>
<f:selectItem itemLabel="22:00"
itemValue="22:00"/>
<f:selectItem itemLabel="23:00"
itemValue="23:00"/>
</ets:selectWithLabel>
</p:outputPanel>
<p:outputPanel
rendered="#{policyBean.renderDaysBeforeCheckinOpt}"
formCol="6">
<ets:inputNumberWithLabel decimalPlaces="0"
required="true"
requiredMessage="#{messages['pages.cancellationPolicies.pleaseAdaysbeforecheckin']}"
label="pages.cancellationPolicies.adaysbeforecheckin"
minValue="0"
formCol="6"
maxValue="30"
styleClass="number-form-control"
id="adaysbeforecheckin"
value="#{policyBean.cancelationPolicyPojo.daysBeforeCheckinValue}">
<p:ajax event="blur"
update="adaysbeforecheckin"/>
</ets:inputNumberWithLabel>
</p:outputPanel>
</p:outputPanel>
</div>
<div
class="col-md-10 minsizeText">#{messages['pages.cancellationPolicies.penaltyCharge.description']}
</div>
<div class="row">
<p:outputPanel id="penaltyRenderArea">
<p:outputPanel>
<ets:selectWithLabel
id="penaltyType" required="true"
requiredMessage="#{readMessage.getValidationMessagesValue('cancellationPolcy.penType.cant.be.null')}"
label="pages.cancellationPolicies.penaltyCharge"
formCol="6"
firstItem="#{messages['global.pleaseSelect']}"
value="#{policyBean.cancelationPolicyPojo.penaltyType}"
disabled="#{policyBean.penaltyDisable}">
<f:selectItems
value="#{policyBean.penaltyTypeList}"
var="var"
itemValue="#{var}"
itemLabel="#{messages['cancelationPolicyBean.penalty.'.concat(var.friendlyName())]}"
/>
<p:ajax event="change"
listener="#{policyBean.handlePenaltyChange}"
resetValues="true"
update="@form:dropDownPenalty"/>
</ets:selectWithLabel>
<p:outputPanel id="dropDownPenalty">
<p:outputPanel
rendered="#{policyBean.renderPenaltyTotalPrice}">
<ets:inputNumberWithLabel
formCol="6" required="true"
requiredMessage="#{messages['pages.cancellationPolicies.penaltyValueOfTotalPrice']}"
label="pages.cancellationPolicies.ofTotalPrice"
value="#{policyBean.cancelationPolicyPojo.penaltyValueOfTotalPrice}"
symbol="%"
decimalPlaces="0"
emptyValue="empty"
minValue="0"
id="penaltyValueOfTotalPrice"
styleClass="number-form-control"
maxValue="100">
<p:ajax event="blur"
update="penaltyValueOfTotalPrice"/>
</ets:inputNumberWithLabel>
</p:outputPanel>
</p:outputPanel>
</p:outputPanel>
</p:outputPanel>
</div>
<div
class="col-md-10 minsizeText">#{messages['pages.cancellationPolicies.noShow.description']}
</div>
<div class="row">
<p:outputPanel id="noShowPanel">
<ets:selectWithLabel
id="policyNoShowType"
label="pages.cancellationPolicies.noShow"
requiredMessage="#{readMessage.getValidationMessagesValue('cancellationPolcy.noshow.cant.be.null')}"
firstItem="#{messages['global.pleaseSelect']}"
required="true"
formCol="6" event="change"
value="#{policyBean.cancelationPolicyPojo.policyNoShowType}">
<f:selectItems
value="#{policyBean.cancelationPolicyNoShowTypes}"
var="var" itemValue="#{var}"
itemLabel="#{messages['cancelationPolicyBean.noshow.'.concat(var.friendlyName())]}"/>
</ets:selectWithLabel>
</p:outputPanel>
</div>
<div class="row">
<div class="dialog-footer">
<div class="col-md-12">
<ets:submitButton value="#{messages['global.save']}"
update="@form:canDatatable,@form:cancellationDetail,@form:messages,@form:content"
ajax="true"
process="@form:canPolPanel"
styleClass="btn-info btn pull-right"
action="#{policyBean.saveCancellPolicy()}">
</ets:submitButton>
</div>
</div>
</div>
<p:ajax event="close"
process="@this"
resetValues="true">
</p:ajax>
</p:outputPanel>
</p:outputPanel>
</f:validateBean>
</p:outputPanel>
</p:dialog>
當我不填充驗證是以後執行正確的輸入,如果我關閉對話框提交對話框(放棄了,不想要保存模式)由於執行和失敗驗證我無法提交父表單由於這個問題。任何幫助將不勝感激!