Submitting a Form that has Control Events


Gene Wirchenko

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Latest member

Latest Threads