Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Other (please specify)

Status
Not open for further replies.

harrysdad

Programmer
May 30, 2002
53
GB
I am setting up an application to allow recruitment department to post vacancies direct to the intranet. I have decided to go for asp and msaccess.

They handle recruitment for several organisations, so I am putting a drop down list so they can pick the employer that goes with the vacancy on the record insertion form. Occasionally they will handle recruitment for other organisations who will not be predictable, so I need to give them the facility to input an employer that does not appear in the list. I thought of doing this via a seperate text box helpfully marked "Other (please specify)"

What is the best way to approach this?
 
Add an item to your <select> list named &quot;other&quot;:

<form name=&quot;recruitment&quot; action=&quot;&quot; onsubmit=&quot;return checkIt(this)&quot;>
<select name=&quot;employer&quot;>
. . .
<option value=&quot;other&quot;>other
</select>
<input type=&quot;text&quot; name=&quot;someother&quot;>
<input type=&quot;submit&quot;>

Then you need to validate if the user entered someting in the text field, but only if &quot;other&quot; was selected in drop-down list:

<script>
function checkIt(theform) {

if (theform.employer.options[theform.employer.selectedIndex].value == &quot;other&quot;
&& theform.someother.value == &quot;&quot;)
{
alert('You should specify an employer');
return false // something is wrong in input; form won't be sent
}

else
return true // input is OK, form will be sent
}
</script>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top