On Wed, 15 Sep 2004 12:46:57 -0500, minaozoptics
<mi*****************@mail.forum4designers.com> wrote:
I have prepared a form with frontpage.
Did you have to? Frontpage is a plague upon the Web, spitting out badly
malformed HTML. It would be quicker to write the page by hand, than to gut
the trash that Microsoft products like Frontpage and Word add.
Unless you're well-versed in HTML, I'd advise you learn to code by hand
first and validate your pages.
Before submitting the form I want the user to bu sure that he has
completed it exactly. Sometimes people click ENTER button just to
continue the fill next part of the form but when we click
ENTER,unfortunately, the form is submitted directly.
To my knowledge, I've never encountered a browser that switches fields
with the Enter key. I've always used Tab. Users should know their browser
well enough to know which method to use. If you are really worried about
accidental submissions - for example, the form initiates some critical
action - add an intermediary page that asks for confirmation. Don't rely
on Javascript.
[snip]
So how can I verify both required parts in the form and that the user is
OK to send the form?
You could use:
<form ... onsubmit="return verify() && validate()">
which would normally be written as
return verify() && validate();
If verify returns false (the user cancels), the evaluation will
short-circuit, and the form won't be submitted. If the user does confirm,
then validate must also return true in order for the submission to proceed.
However, I think that the confirmation should be moved to the server, if
you really feel it's necessary, just as server-side validation should also
occur with client-side used just to speed things up.
Hope that helps,
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.