File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Question on javascript Confirm Button for jsf or icefaces equivalent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Question on javascript Confirm Button for jsf or icefaces equivalent" Watch "Question on javascript Confirm Button for jsf or icefaces equivalent" New topic
Author

Question on javascript Confirm Button for jsf or icefaces equivalent

john smiths
Greenhorn

Joined: Feb 19, 2012
Posts: 3

Hi All:

I am currently using Icefaces 1.82, jsf 1.1 and weblogic 10.3.2.
In javascript, there is the confirm function where the user can choose "OK" OR "cANCEL". Is there something similar in Icefaces or Jsf?


Example of Javascript confirm function:\
confirm(" The number exists go to booking!")

Any hint or help would be greatly appreciated it.
Louis Bros
Ranch Hand

Joined: Jun 03, 2011
Posts: 54

Hi,

The <h:commandButton/> has the 'onclick' attribute you could use for this.

Something like:



Ta


OCA7
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16101
    
  21

More correctly:


Without the "return" directive, the confirmation's return value may not get passed on to the control.


Customer surveys are for companies who didn't pay proper attention to begin with.
Louis Bros
Ranch Hand

Joined: Jun 03, 2011
Posts: 54

Thanks Tim, I usually use the 'return' but wasn't sure of it's purpose since it seemed to work the same without. Now I know, cheers
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16101
    
  21

Louis Bros wrote:Thanks Tim, I usually use the 'return' but wasn't sure of it's purpose since it seemed to work the same without. Now I know, cheers


There may be some browsers where it's essential and some where it's optional, but it never hurts. A more important reason is that JSF rendering into HTML may add additional "invisible" JavaScript before and/or after the attribute value. Placing the "return" there ensures that the following code won't be executed and possibly override application-programmer JavaScript.

In fact, it's probably even better to code it this way:

That would ensure that any pre-submit generated JavaScript would only be bypassed if the submit process was aborted. When in doubt, though, check the manual (assuming it bothers to say one way or the other) and check the generated HTML.
 
GeeCON Prague 2014
 
subject: Question on javascript Confirm Button for jsf or icefaces equivalent