Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Commandbutton onclick and actionlistener happen at same time

843844Feb 5 2008 — edited Feb 5 2008
I started a thread previously with a similar issue, but the title of that thread really doesn't describe the current problem. Sorry for double posting, but I would delete that thread if I could.

I have a command button as:

<h:commandButton id="saveCloseFoil" type="submit"
onclick="javascript:saveText();"
action="#{Item.saveOptionAction}"
value="#{propertiesBundle.saveCloseSubmitLabel}"
actionListener="#{Item.setFoilTextToBean}" />

The saveText() javascript function copies the text from a text editor to a field defined as:

<h:inputHidden id="hiddenTextField" value="" />

The actionlistener should take the value from the hidden field, and put it in the backing bean. The Action then saves that value in its correct place in the database.

The problem is that the onclick and actionlistener are firing at the exact same time(i am verifying this by using the firefox javascript debugger breakpoints for the javascript and JDeveloper breakpoints for the actionlistener. Both breakpoints stop at the same time.)


The strange thing is that in another place in our applicate we have an almost identical button:

<h:commandButton tabindex="3" type="submit" id="submit"
onclick="javascript:setBrowserSettings();"
action="#{Login.loginAction}"
actionListener="#{Login.setBrowserOSSettings}"
value="#{propertiesBundle.loginLabel}">
</h:commandButton>

in which the onclick is run first, then the actionlistener, then the action. I verified this using the exact same method as with the button I am working on now.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 4 2008
Added on Feb 5 2008
3 comments
319 views