• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on javascript Confirm Button for jsf or icefaces equivalent

 
john smiths
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 54
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Something like:



Ta
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More correctly:


Without the "return" directive, the confirmation's return value may not get passed on to the control.
 
Louis Bros
Ranch Hand
Posts: 54
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic