I have this piece of code that fails to work. I have fieldToStore defined. I can alert it and I can see its value in firebug console, but when it is passed to myBean it is always undefined in case of a String value or false in case it’s boolean.
Any ideas?
<a4j:commandButton id="bt1" action="#{myBean.doSomething}" onclick="fieldToStore=false;saveFieldState();">
</a4j:commandButton>
<a4j:jsFunction name="saveFieldState" action="#{myBean.dummyAction}" />
<a4j:actionparam name="fieldToStore" assignTo="#{myBean.fieldToStore}" />
</a4j:jsFunction>
My expectation is that after i click on bt1 the value of myBean.fieldToStore is false, as per the javascript var fieldToStore.
I figured it out… the problem was on the way i was calling the jsFunction on the event onclick:
it should be:
The example on richfaces documentation is misleading:
Imo it should be onload=”callScript(param_name)”.