How would I go checking if a certain submit button was pushed and if so
confirm the user if he is sure.
But if he pushes cancle, then it will cancle the operation.
| SitePoint Sponsor |


How would I go checking if a certain submit button was pushed and if so
confirm the user if he is sure.
But if he pushes cancle, then it will cancle the operation.
Danny Grubman @ http://www.our-network.net
"Intellectuals solve problems; geniuses prevent them."
Basically, once the user clicks on that submit button, he'll be asked to confirm whether he wants to continue or not with an "OK/Cancel" alert (known as a "confirm"). If he clicks OK the form submits as usual; if he clicks cancel, execution of the form stops.HTML Code:<input type="submit" name="submit" value="Go!" onclick="return confirm('Are you sure you want to do this? I mean, you might not want to after all :)');" />


Thanks for your help m8.![]()
By the way, what about making the proccess stop after a certain alert?
Here is an example:
Lets say that an alert pops up and say that a certain function was desable and
after the user clicks ok no proccess will take place.
Danny Grubman @ http://www.our-network.net
"Intellectuals solve problems; geniuses prevent them."
Garcia's example implies this,Originally Posted by sleepingdanny
It would be the return of the return...so to speak. If the function you call returns *false* and the onclick event also returns that value, which is false, then the form would not be submitted and you could display an alert box at the time it fails.
The below code, would be inserted into the function you are calling:
Hope this helpsCode:alert("Alert User and Kill Form"); return false;


Exacly what I needed, thanks.
Danny Grubman @ http://www.our-network.net
"Intellectuals solve problems; geniuses prevent them."
Bookmarks