By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,563 Members | 918 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,563 IT Pros & Developers. It's quick & easy.

Required items in a form

P: n/a
What I'm trying to do is essentially force a user to fill in required items
in a form, which will be saved to a database. How can I get it so that once
the user clicks "OK" on the dialog box, it transfers control back to the
form, and not save the empty fields into the database?
Jul 1 '08 #1
Share this Question
Share on Google+
2 Replies

P: n/a
On 2008-07-01, Brandon <de**********@verizon.netwrote:
What I'm trying to do is essentially force a user to fill in required items
in a form, which will be saved to a database. How can I get it so that once
the user clicks "OK" on the dialog box, it transfers control back to the
form, and not save the empty fields into the database?
Follow the golden rule of not trusting user input.

When you get back values for the fields, check them, and if not correct, ask
again, give an error, abort the program, erase the data base, reboot the
system, whatever is appropiate to handle such an error.

Sincerely
Albert
Jul 2 '08 #2

P: n/a
"Brandon" <de**********@verizon.netwrote:
>
What I'm trying to do is essentially force a user to fill in required items
in a form, which will be saved to a database. How can I get it so that once
the user clicks "OK" on the dialog box, it transfers control back to the
form, and not save the empty fields into the database?
What do you mean by "transfers control back to the form"? A form doesn't
have any code, and so can't "control" anything.

Now, it is certainly possible to define an onSubmit handler in the <form>
header, then write a Javascript function that validates the input. If the
function returns false, the submit won't happen.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 4 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.