Web Hosting Talk







View Full Version : Are you sure?


jlee2301
09-14-2004, 05:54 AM
Hi guys

Just a simple one I think:

I have a simple form that the user enters an id number in and clicks a submit button to delete the entry from a database.

I need some form of check that asks the user "are you sure you want to delete this entry" with a yes and no option. If the no option is selected then it needs to not delete it obviously and return to where teh user was, but if they click yes then it needs to continue. Any help would be appreciated - thanks

WLHosting
09-17-2004, 04:38 PM
Is this a PHP script?

armstrongecom
09-17-2004, 06:11 PM
You might try putting this in the <form> tag or as a separate function...

onSubmit="javascript:return if (confirm("Are you sure you\nwant to delete?\n")){return(true);}else{return(false);}"

azizny
09-17-2004, 06:56 PM
Originally posted by armstrongecom
You might try putting this in the <form> tag or as a separate function...

onSubmit="javascript:return if (confirm("Are you sure you\nwant to delete?\n")){return(true);}else{return(false);}"


onSubmit="javascript:return confirm("Are you sure you\nwant to delete?\n);}"

:D

armstrongecom
09-17-2004, 08:24 PM
Thanks azizny, yes that would be simpler. Except I just noticed that we both goofed up the quotation marks. Should be...

onSubmit="javascript:return confirm('Are you sure you\nwant to delete?\n');"

-A

mwaseem
09-18-2004, 06:35 AM
Here is more simplified version :)

<script language="javascript">
function AskDel() {
return confirm("Are you sure you want to delete the selected user?");
}
</script>

<input type="submit" value="Delete" onClick="return AskDel()">