File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

possibility to change action

 
Erik Gothe
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17624
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic