Wow my thread kinda derailed there for a second. I got it working after the second reply or so, but I'll post the code I used if anyone wants to use it.
Javascript:
<script language="JavaScript" type="text/javascript">
function sevent() {
var dd = document.register.country_register.selectedIndex;
var txt = document.register.country_register[dd].text;
if(txt == 'United States'){
document.register.state_register.disabled = '';
} else {
document.register.state_register.disabled = 'disabled';
}
}
</script>
I'll explain the code for anyone who knows no Javascript, like me.
var dd = document.register.country_register.selec tedIndex;
When the function is called, this sets a variable dd to the number of the selected element.
var txt = document.register.country_register[dd].t ext;
This then sets a variable txt to the actual text value of the selected element.
if(txt == 'United States'){
If, when the function is called, the selected element is anything United States...
document.register.state_register.disable d = '';
...enable the state select box.
} else { document.register.state_register.disable d = 'disabled';
Otherwise, disable the box.
You just need to call the function sevent() when the element changes in the country box. Here's the HTML code:
<select name="country_register" onchange="sevent()">
<!-- Country options here -->
</select>
Hope this helps out!