Hello,
My intended scenario is that, there is a Button component on the visual web jsf page and someone click on the button, instantly a confirm box (javascript) is displayed. Now if the person click on the ok button of the box the form will be submitted but the form will not be submitted if the person click on the cancel button of the confirm box. How can this be accomplished?

This is possible to throw a confirm box by using javascript easily but the click on the cancel button doesn’t prevent of the form submission.

Thanks to all.

monad

Recommended Answers

All 3 Replies

<input type='submit' value='submit' onclick='return(confirm("Are You Sure"));'>
<!-- or -->
<form action='formhandler.ext' method='post' onsubmit='return(confirm("Are You Sure"));'>

Think I messed up the code

<input type='submit' value='submit' onclick='return confirm("Are You Sure");'>
<!-- or -->
<form action='formhandler.ext' method='post' onsubmit='return confirm("Are You Sure");'>

neither set looks right,
but one works,

Thanks almostbob!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.