简体   繁体   中英

h:selectOneListbox onchange and a4j:support event onchange conflicts

I have code like below in jsp page...

<h:selectOneListbox size="1" id="doseUnit"  onchange="generateSignature(),quantityUnitSelecator()" value="#{templatePrescriptionMaintenanceBackingBean.prescriptionUnit}">
<f:selectItems value="#{templatePrescriptionMaintenanceBackingBean.doseUnit}"/>
<a4j:support ajaxSingle="true" reRender="quantity,signature,signatureHidden,doseWarningList" actionListener="#{templatePrescriptionMaintenanceBackingBean.generatePrescriptionQuantity}"
event="onchange">
</a4j:support>

If I use event="onchange" inside a4j it is not calling my generatePrescriptionQuantity but if I use event="onblur" it works fine. So I thought it's cause of onchnage method of listbox. Actually I have to make that effect onchange and also have to call that scripts.


UPDATE


Issue resolved for first select when I did below modifications but for second select (Which is just below first selectone) same issue continue... I can't understand why this is ????

<h:selectOneListbox size="1" id="doseUnit" value="#{templatePrescriptionMaintenanceBackingBean.prescriptionUnit}">
<f:selectItems value="#{templatePrescriptionMaintenanceBackingBean.doseUnit}"/>
<a4j:support ajaxSingle="true" reRender="quantity,signature,signatureHidden,doseWarningList" actionListener="#{templatePrescriptionMaintenanceBackingBean.generatePrescriptionQuantity}"
event="onchange" oncomplete="generateSignature(),quantityUnitSelecator()">
</a4j:support>

<h:selectOneListbox size="1" id="route" value="#{templatePrescriptionMaintenanceBackingBean.prescriptionRoute}">
<f:selectItems value="#{templatePrescriptionMaintenanceBackingBean.route}"/>
<a4j:support ajaxSingle="true" reRender="quantity,signature,signatureHidden,doseWarningList" actionListener="#{templatePrescriptionMaintenanceBackingBean.generatePrescriptionQuantity}"
event="onchange" oncomplete="generateSignature()">
</a4j:support>

Could it be that your onchange in the h:selectOneListbox doesn't play well with an onchange in the a4j:support? Try removing your onchange from the listbox and put it in the onsubmit attribute of the a4j tag.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM