473,325 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

2 actions in onsubmit


Hi,

I have prepared a form with frontpage.

Before submitting the form I want the user to bu sure that he ha
completed it exactly. Sometimes people click ENTER button just t
continue the fill next part of the form but when we clic
ENTER,unfortunately, the form is submitted directly.

So I have written a function verify with javascript.

As following it works correctly:

onsubmit="return verify()"

So that the user needs to accept that he is OK to submit the form.

But when I added some required parts in the form that should b
verified the first fuction verify is no longer active.

So how can I verify both required parts in the form and that the use
is OK to send the form?

Thanks so muc
-
minaozoptic

Jul 23 '05 #1
1 1645
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() &amp;&amp; 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.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stuart Wexler | last post by:
Hi, I have a form with onSubmit embedded in the <form> tag. The form is submitted programatically through javascript . While the form submits fine, nothing I'm doing seems to get it to...
3
by: n3mtkj3mzsir0cy | last post by:
I have created web pages that do client-side form validation using the onclick directive. E.g., <form action=other_page.cgi method=post> Enter your age: <input name=age> <input type="submit"...
2
by: Sean Dockery | last post by:
Which is the following is correct? a) <form ... onSubmit="return checkData()"> b) <form ... onSubmit="return checkData();"> c) <form ... onSubmit="checkData()"> d) <form ......
4
by: usl2222 | last post by:
Hi folks, I appreciate any assistance in the following problem: I have a form with a bunch of dynamic controls on it. All the controls are dynamically generated on a server, including all...
2
by: jimfromsd | last post by:
I have a particular problem where I need to have one form perform two actions. Can you just have 2 actions in the action parameter ("action = ....blahblah.asp, ...yaddayadda.jsp") or is there some...
1
by: elia | last post by:
Hello, I can't do two actions wich must be done on a form having two buttons. (payment by invoice and payment by Credit card) The first action establishes a link on two differents pages...
5
by: Tyrone Slothrop | last post by:
I have created a form which has two submit buttons. The first is a preview button to view the data they have entered into a formated page. The second actually submits the data for saving. The...
8
by: Mark Livingstone | last post by:
I have a form that uses the following: onSubmit="some_var = 'validated';" FireFox is OK with that. Internet Explorer isn't. any ideas why? Thanks.
1
by: vunet | last post by:
I write a JS library component which is applied to every form on a webpage. The component does something before it submits the form. Now, let's say user has his own onSubmit() handlers returning...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.