Click here to Skip to main content
15,941,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends,
i have delete button in my .aspx page.

Delete;

and i have a form in my page.
the check function shows a confirm("are you sure") using javascript

now i want if anyone hit the no form should not get submit. and if hits Yes form should be submitted.

help me.....
Posted

Hi,

(1) put a return statement which calling the Check function as follows

<button type="submit" value="Delete" önclick="return Check()">Delete</button>;


(2) In the Check() function mention "return true" if user clicks YES. Simillarly, if he clicks NO then return false.
 
Share this answer
 
C#
function Check()
{
    // confirm return true of false
    var chk=confirm("Are you sure");
    // if true
    if(chk)
    document.forms.submit();
}
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900