|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Confirm dialog box
I want to know how to make a confirm alert dialog box before submitting a form. I think it is something to be done with VBscript. But, I have no idea of how to code it in the page. Can someone give me a simple example of how to create a alert box something like:
"Are you sure you want to delete selected items?" with Yes, No buttons in it. And I want to know how to know the option user has selected for the question we provide them. Thanks for your attention! |
|
#2
|
|||
|
|||
|
RE: Confirm dialog box
OK - here's one way to do it using Javascript... you should be able to modify the code easily enough to suit you
Code:
<script language="javascript">
function getconfimation()
{
var yousure = confirm("Are you sure you want to delete selected items?");
if (yousure == true)
{
// They've selected 'Yes' so submit the form
document.formname.submit();
}
else
{
// do something else - they've selected 'No'
}
}
Then, instead of a submit button at the end, use something like this: Code:
<a href="#" onclick="getconfirmation()">Delete Selected Items</a> hope this helps |
|
#3
|
|||
|
|||
|
RE: Confirm dialog box
It did the job clamly! I appriciate your answer!
You can even have a submit button. Then you need to call your function like this: <form onSubmit="retur getconfirmation()"> <script language="javascript"> function getconfimation() { var yousure = confirm("Are you sure you want to delete selected items?"); if (yousure) return true; else return false; } Both the same! Thread resolved! |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Confirm dialog box |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|