Hi

I'm using javascript to generate a dynamic select list (this page - http://www.insideliquor.com.au/jobs/...job-search.php) . Problem being when category is changed, and position is left as ĎAny positioní no value is sent in the query string for position. ie it should be Ďanypositioní. This is corrected by hitting the back button and submitting again without further change.

Appreciate any suggestions about how to resolve this problem. Code shown below, Thanks.

<form name="jobsearch" id="jobsearch" class="generic inline" method="get" action="job-search-results.php">
<label for="category">Category</label>
<select id="category" name="category" class="text" onchange="setPositions(this)">
<option selected value="anycategory">Any category</option>
<option value="retail">Retail</option>
<option value="supplier">Supplier</option>
<option value="hotel">Hotel</option>
<option value="other">Other</option>
</select>
<label for="position">Position</label>
<select id="position" name="position" class="text">
<option selected value="anyposition">Any position</option>
</select>
<input type="submit" name="jobsearch-submit" value="SEARCH" />
</form>

<script type="text/javascript">
var positiongroup = new Object( )
positiongroup["retail"] = [{value:"retailassistant", text:"Retail Assistant"},
{value:"retailsupervisor", text:"Retail Supervisor"},
{value:"areamanager", text:"Area Manager"}];

positiongroup["supplier"] = [{value:"1111", text:"1111"},
{value:"2222", text:"2222"}];

positiongroup["hotel"] = [{value:"aaaa", text:"aaaa"},
{value:"bbbb", text:"bbbb"}];

positiongroup["other"] = [{value:"other-1", text:"other-1"},
{value:"other-2", text:"other-2"},
{value:"other-3", text:"other-3"}];

function setPositions(chooser) {
var positionChooser = chooser.form.elements["position"];
// empty previous settings
positionChooser.options.length = 0;
// get chosen value to act as index to positionChooser hash table
var choice = chooser.options[chooser.selectedIndex].value;
var db = positiongroup[choice];
// insert default first item
positionChooser.options[0] = new Option("Any position", "", true, false);
if (choice != "") {
// loop through array of the hash table entry, and populate options
for (var i = 0; i < db.length; i++) {
positionChooser.options[i + 1] = new Option(db[i].text, db[i].value);
}
}
}
</script>