0

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>

Ketan Bhavsar
  • 5,338
  • 9
  • 38
  • 69
  • Sounds like as if one of your JS functions crashed and thus left the JS context in a terminated state (which in turn causes the ajax request not being fired at all). Check the JS console for any errors. – BalusC Sep 12 '12 at 15:08
  • @BalusC yes looks like same I removed scripts and withought script it worked fine. still my script error console having NO ERROR. By the way thanks BalusC... – Ketan Bhavsar Sep 13 '12 at 05:14
  • I'm sorry, I'm not understanding, are you still having issues with your second one? Without the scripts it worked fine? If you've got nothing in your console put some alerts in your scripts to see if it's making it through them without dying. Also, I'm not sure how "return false" statements might play with a4j's oncomplete (if at all), but might be worth looking to see if your js is returning false and if so, if that has any effect. Sorry, I'm not a jsf guru; so just grasping here. Good luck. – mschor Sep 13 '12 at 15:21
  • @mschor Thanks for your reply... It's glitch mistake I found in my code. Actually it was calling my java method `generatePrescriptionQuantity`. logic inside that method is too large and in between some condition there was a return calls, which result me back and my required code was not executing. It's nothing but my trace issue. I need to be more perfect. But thank you both @BalusC (JSF master...) and You... – Ketan Bhavsar Sep 14 '12 at 05:59

1 Answers1

1

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.

mschor
  • 141
  • 4
  • Instead of Onsubmit I put it in oncomplete event that worked for me but I have multiple selectonelistbox in sequence and I have to take that step for all a4j of every select. For 1st select this solution worked but on very next select that doesn't. Let me update my code for more clear. – Ketan Bhavsar Sep 12 '12 at 15:00
  • Thanks mschor for your kind help. I have update my question. plz help. – Ketan Bhavsar Sep 12 '12 at 15:05