WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: JavaScript

for

From: Stanzel, Susan - FSA, Kansas City, MO
Date: Jun 25, 2013 8:17PM


Well, I have selected the code and I will paste it below in plain text. When the state code is selected then I tab to the county codes which are for the specific state. I have also selected the JavaScript for filling the county list which I will paste below the HTML code.
<td><font color = "red">*</font>State:</td>
<td>
<LABEL for="select state"><select name="stateFsaCode" onchange="resetCountyList();"><option value="">-- Select State --</option>

<option value="01">Alabama</option>
<option value="04">Arizona</option>
<option value="05">Arkansas</option>
<option value="06">California</option>
<option value="12">Florida</option>
<option value="13">Georgia</option>
<option value="20">Kansas</option>
<option value="22">Louisiana</option>
<option value="28">Mississippi</option>
<option value="29">Missouri</option>
<option value="31">Nebraska</option>
<option value="35">New Mexico</option>
<option value="37">North Carolina</option>
<option value="40">Oklahoma</option>
<option value="45">South Carolina</option>
<option value="47">Tennessee</option>
<option value="48">Texas</option>
<option value="51">Virginia</option></select></LABEL>
</td>
</tr>

<tr>
<td><font color = "red">*</font>Buying Point Number:</td>
<td><LABEL for="buying point identification"><input type="text" name="buyingPointIdentification" maxlength="5" size="5" value="" alt="buying point ID"></LABEL></td>
<td><font color = "red">*</font>County:</td>
<td>
<LABEL for="select county"><select name="countyFsaCode" onfocus="fillCountyList();"><option value="">-- Select County --</option></select></LABEL>
</td>
</tr>

Here is the JavaScript.
function fillCountyList()
{
if(document.forms[0].elements['stateFsaCode'].selectedIndex == prevStateIndex)
{
return;
}

var selectObj = document.forms[0].elements['countyFsaCode'];

selectObj.options.length = 0;
selectObj.selectedIndex = -1;

selectObj.options[0] = new Option(' Loading... ', '');

selectObj.disabled = true;

document.forms[0].submit();
}

Please let me know what else you might need.

Susie Stanzel