Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Submitting a Form that has Control Events

Thread Tools

Submitting a Form that has Control Events

Gene Wirchenko
Posts: n/a
Dear JavaScripters:

I am putting what I thought would be the final touches on the
first cut for a form handler.

I have validation on controls and on the form as a whole. The
control-level validations work just fine, and focus does not move off
the control. This is what I want.

I now need to have the submit sequence done. Roughly, it is:
Run validation on each data control stopping if an error and
setting the focus to the erroneous control.
Run each form-level validation stopping if an error and
setting the focus to the first of the erroneous controls.
The actual submit (not implemented yet).

I click Submit and...

Sometimes, especially if the current control is one that has a
validation rule, the function I have written for submitting does not
get run. (If there is a control validation, the control validation
will run.) Clicking again on the submit button will usually result in
the submit code then running.

Note that if the form-level validation runs, it does run
correctly. My problem is sometimes, it does not run at all. (An
alert() at the beginning of the function does not execute.)

This is obviously not what I want. I have done some looking, but
I have not found anything covering this. Part of the problem that I
am having is that I am not sure how I should be coding this. The
simplistic form submit code that I have found is not enough.

Could someone please post some skelton code or pointer to the
same for submitting when some processing has to be done first,
especially code that understands control events can occur?


Gene Wirchenko
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Form within a Form - will it cause problems when submitting? Dave Smithz HTML 3 10-30-2009 07:24 AM
Submitting form with multiple onclick events Samuel Hon ASP .Net 4 03-06-2004 09:27 AM
Submitting form from another frame does not run onsubmit of that form Kai Grossjohann Javascript 4 12-09-2003 02:49 PM
submit opener form after submitting pop-up form Marco Alting Javascript 7 10-30-2003 01:46 PM