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!

prevent the post back from instantiating

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 when there are now issues with the JS form field validation.

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



<<HTML>>

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

<asp:ImageButton ID="savePersonalInfo" runat="server" ImageUrl="/images/saveBtn.gif" OnClick="saveInfo_Clicked" />

What is happening is that the JS is working, it found a null field for first name and alertd the user. But when the "OK" was pressed on the JS alert, the page did a postBack. Han can this be stopped, until all fields pass the JS validation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top