[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


run a javascript form onsubmit on an aspx page

Posted on 2005-05-06
Medium Priority
Last Modified: 2008-03-17
I have an html page with client-side javascript that calls a forms OnSubmit event (<form onsubmit="return ValidateForm(this);" action="">). ValidateForm(this) sets in motion a bunch of other javascript code after validation. However, I now need to move this form into an aspx page in order to take advantage of aspx layout and a bunch of controls for layout purposes. Now of course, when I click on my submit button, it causes postback, which I don't want.

How do I disable postback so that the client-side code in the form OnSubmit can run, or rather, display (as the results of it are not displayed because of the postback - it's as if the code had never run)?


Question by:ovalsquare
LVL 23

Accepted Solution

Jens Fiederer earned 750 total points
ID: 13947936

Author Comment

ID: 13947998
I actually ended up just putting it in a button onclick event, and then accessed the form values from within the code, but jensfiederer's solution I wasn't aware of before, so will squander hard earned points on you 'cause I might use in future ;-)


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question