*
The moose likes JSF and the fly likes JS confirm for h:commandButton?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JS confirm for h:commandButton??" Watch "JS confirm for h:commandButton??" New topic
Author

JS confirm for h:commandButton??

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,
I would like for a user to confirm that he/she wants to undertake a submit action. I have a h:commandButton and I would like to use the JS confirm function and the onclick attribute in order to do that. The problem is when I want to submit the form (once the user has clicked yes on the confirm button) and I do not want to hard-code the path to the form. Another problem is that I have several h:commandButtons on the form.
Can anyone please help?
Thanks in advance,
Julien Martin.

My code

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
I was given the solution by someone. Here it is:

Julien.
Ronald Aguilar
Greenhorn

Joined: Sep 14, 2004
Posts: 21
u can use this:

------------------------------------------------
on.click="return confirmationSave()"

------------------------------------------------


<script type="text/javascript">

function confirmationSave() {

var answer = confirm("Confirm Save")

if (answer == true){
return true;
}else{
return false;
}

}
</script>


Ron
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JS confirm for h:commandButton??
 
Similar Threads
Problem with submit()
rich:dropSupport not working
Component ID frm1_window viewid has already been found in the view
Model update problem
Problem with h:message and richfaces