Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

validate form fields not on post back

Status
Not open for further replies.

tester321

Programmer
Mar 13, 2007
150
CA
Hi how does one intantiate a javascript function to do form field validation without a PostBack? But yet keep the postBack to process the form fields.

This is what i have/am doing:
<<PAGE BEHIND>>
protected void Page_Load(object sender, EventArgs e)
{
....
savePersonalInfo.Attributes.Add("onclick", "return validateData()");
....
}

protected void saveInfo_Clicked(object sender, ImageClickEventArgs e)
{
//do something with the form values after passed JS validation
}

<<HTML>>

<script>
function validateData() {.....
</script>

<asp:ImageButton ID="savePersonalInfo" runat="server" ImageUrl="/images/saveBtn.gif" OnClick="saveInfo_Clicked" />
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top