View Full Version : Data in one requires data in another-Help!

01-21-2009, 02:23 AM
I am trying to build a form that forces data entry (text) into a field if a
previous ( or other ) field has data in it.
Example: If there is data in the "Full Name" block, you MUST put data in
the "Crew Name" block or the form will not submit.
If the "Crew Name" block is empty and data is entered into the "Full Name" block..on exiting, a validation error message will show.
("Crew Name" is the first block..."Full name" (multiple lines for the whole crew) is after.))

John Doe is entered into "Full Name" area. Person tries to enter next "Full Name" into the next block without giving the Crew a name. Validation message pops up.

Also, how do I validate this ?
I'm a noob at this....lol

01-21-2009, 02:58 AM
i would suggest javascript and php (if you are using php). Java script will give an immediate response IF the user has not got it turned off.

what will you do with the info ? mail it or store it?

01-21-2009, 03:42 AM
just been playing with this with java script
<script type="text/javascript">
function checkform()
if (document.contact.Full_Name.value != ''&& document.contact.Crew.value=='')
// something is wrong
alert('Please add your crew details');
return false;

return true;


and form
<form action="" method="post" onSubmit="return checkform()" name="contact" id="contact">

<input name="Full_Name" type="text" />Full Name<br />

<input name="Crew" type="text" />Crew
<input name="submit" type="submit" value="Submit" /></form>

try it im no javascript devotee but i think it will work for what you ask

01-21-2009, 04:14 AM
Thnx..I'll give it a Try ! :-D

01-21-2009, 07:20 AM
Errrr...I hate to ask ( noobie here ) where do insert this first part ? after the word ..Head..? and the second part ?

Also...there are more than one crew to a sheet so at every new Crew list...repeat? example below:
Crew Name____________
Full Name_______________
Full Name_______________
Crew Name______________
Full Name_______________
Full Name_______________
and so on...for 3 Crews each application form
We are trying to keep the costs down ( non-profit ) so we don't have a REAL server setup. Company wants $$ to develope a solution...and I don't blame them... : )
Thanx Sooo Much!

01-21-2009, 07:25 AM
between <head> and </head> !st part the second is the form i gave which goes i the <body>where i have
is because I called the form contact and the field Full_Name you will hjave to edit to your form and do not forget to add
onSubmit="return checkform()" to your form so it will call the script