Jump to content
Larry Ullman's Book Forums

Post Description And Not Values


Recommended Posts

I have created Jobseeker Registration form and tested it. All's working fine and the email that's received works correctly, however I do have a slight problem.

 

In combobox 1 there are descriptions of the categories ie Agriculture, Catering and Hotel Work ect they are in the "Item Text" each name has a value ie Agriculture is value 1, Catering and Hotel Work is value 2 and so on.

 

When I looked at the database in the table the form has put in the values ie:-

 

job_category 1, 2, ect. How can I get the job category descriptions so the database displays them. I have tried entering the description in the value field and changing the code to read as below but that doesnt work. When I select a job category the 2nd combo box is empty.

 

var combo1 = document.getElementById('Combobox1');

var combo2 = document.getElementById('Combobox2');

var selected = combo1.options[combo1.options.selectedIndex].value;

if (selected == Agriculture)

 

I think I've added the right codeand posted it right this time

 

Any help would be apreciated

 

 

<script type="text/javascript">
function fillSecondCombo()
{
  var combo1 = document.getElementById('Combobox1');
  var combo2 = document.getElementById('Combobox2');
  var selected = combo1.options[combo1.options.selectedIndex].value;
  if (selected == 1)
  {
  combo2.options.length = 3;
  combo2.options[0] = new Option("Please Select", "Please Select");
  combo2.options[1] = new Option("Agricultural Engineer", "Agricultural Engineer");
  combo2.options[2] = new Option("Animal Care", "Animal Care");

<select name="job_cat" size="1" id="Combobox1" onchange="fillSecondCombo();return false;" style="position:absolute;left:138px;top:451px;width:167px;height:22px;z-index:14;" title="Job Category:">

<option selected value="0">Please select an option</option>
<option value="1">Agriculture</option>
<option value="2">Catering and Hotel Work</option>
</select>

<select name="job_skills[]" multiple size="1" id="Combobox2" style="position:absolute;left:127px;top:548px;width:202px;height:163px;z-index:15;" title="Job Skills:">
</select>

Link to comment
Share on other sites

 Share

×
×
  • Create New...