Link to home
Start Free TrialLog in
Avatar of pjordanna
pjordanna

asked on

SIMPLE YES/NO ALERT - URGENT

HI Experts,

Need a really quick answer to the following:

I need an alert box to pop up when a form is submitted with "are you sure you want to do this?" as the message and a choice of "yes" or "no" to be presented in the form of 2 buttons. If "yes" is clicked then the form is submitted, if "no" is clicked then the form is not submitted.


Thanks,



PJORDANNA

ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try:

<form onSubmit="return confirm('Are you sure you want to do this?')">
<input type="submit" />
</form>
or this,
this will call a form validation routine called validateForm() and if the data is valid will then prompt the user to confirm
<script>
function validateForm(objForm){
// data validation goes here
return true;
}

</script>
<form name="myForm" action="" method="" onSubmit="if(validateForm(this)){ return confirm('Are you sure you want to do this?\nClick Ok to continue or Cancel to stop.')} else { return false}">

<input type="submit" value="Submit">
</form>
Avatar of pjordanna
pjordanna

ASKER

OK that's got it.



PJORDANNA