ajax action with a reset button possible?

UI Components for JSF
Post Reply
giberius
Posts: 42
Joined: 08 Jan 2011, 14:20

13 Jan 2011, 01:19

Hi,

<p:commandButton id="resetButton" value="Herstel" type="reset">
<p:ajax process="resetButton" listener="#{autoComplete.handleSelect}" />
</p:commandButton>

I have a reset button. When you press the reset button the changed values in the form will reset to its original values. Then I want to disable the Save Button which I have enabled when the user changed a value in one of the input fields. With a reset button there seems to be no POST and no ajax action.

Is there a possibility for an ajax action or other way to go back to the server so that I can handle it on the Server (in my case disable the Save button and set a boolean changed back to false).

The onclick will work but that only active an ajax script and I need to go back to the server to change the change the state of the presentation logic bean I use.

By the way: just using primefaces, I am very impressed by this library.

Tom

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

13 Jan 2011, 17:21

You could try the remote command component: http://www.primefaces.org/showcase/ui/remoteCommand.jsf

giberius
Posts: 42
Joined: 08 Jan 2011, 14:20

15 Jan 2011, 00:24

ok, that's working.

<p:commandButton id="resetButton" value="Herstel" type="reset" onclick="test()" />
<p:remoteCommand id="resetCommand" name="test" immediate="true" actionListener="#{autoComplete.clearGewijzigd}" update="bewaarButton" />

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests