Click here to Skip to main content
16,002,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Good Afternoon,

How to submit data to an aspx page from an html page after validation is done successfully?

This is my form code
HTML
<form id="frmDoctorRegistration" action="DoctorRegistration.aspx" onscroll="true"  onsubmit="ValidateForm();"   method="post" style="z-index:0" >


This is my button code

HTML
<input type="Submit" id="btnSave" name="btnSave"  onclick="ValidateForm()" value="Save" tabindex="16" /> 


and my problem is as validation messages are shown even html form is submitting to aspx page if I use type="Submit".

and later validation is done I changed input type="Button" data is not submitting to Aspx page.
Posted
Updated 27-Dec-13 21:58pm
v2

1 solution

Try like below...
HTML
<input type="Submit" id="btnSave" name="btnSave" onclick="return ValidateForm()" value="Save" tabindex="16" />

In function ValidateForm, do like below...
JavaScript
function ValidateForm()
{
    if(not validated)
    {
        return false;
    }

    return true;
}
 
Share this answer
 
v2

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