| Author |
possibility to change action
|
Erik Gothe
Greenhorn
Joined: Jan 17, 2013
Posts: 2
|
|
I am doing a javascript confirmation of a form before submitting doing this:
<a4j:commandButton id="save" reRender="resultPanel,preSaveCheck" value="Save" action="#{attributesItem.save}"
disabled="#{!attributesItem.unsaved}" ajaxSingle="true" onclick="if(!confirmDialog()){return false;}"/>
When confirmDialog returns false i want to revert my changes by calling #{attributesItem.revert}.
is it possible to change action method?
How do I make that happen?
|
 |
Erik Gothe
Greenhorn
Joined: Jan 17, 2013
Posts: 2
|
|
I found the solution. I did like this:
<a4j:commandButton id="save" reRender="resultPanel,preSaveCheck" value="Save" action="#{attributesItem.save}"
disabled="#{!attributesItem.unsaved}" ajaxSingle="true" onclick="if(!confirmDialog()){revertSave();return false;}"/>
<a4j:jsFunction name="revertSave" action="#{attributesItem.revert}"/>
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14456
|
|
|
Actually, you are probably better off tying that code to onsubmit, rather than onclick. Most of the time, I don't think you will notice the difference, though.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
|
|
subject: possibility to change action
|
|
|