cscs
09-07-2002, 06:03 PM
hello.
i have two simple dropdowns on my signup page. one is for state, the other for country. i'm using php/mysql to populate the <option> tags, but i guess for the sake of my question that might not be important.
what i want to do is simply disable the STATE dropdown when the COUNTRY dropdown field != USA && != Canada:
if (document.submit_signup.country.value != "USA && document.submit_signup.country.value != "Canada" {
document.submit_signup.state.disabled = true;
}
i'm quite new to js, so i'm not quite certain about where / how this snippet of code can be placed. ie, do i put it at the top of the page with my other functions? or do i put just below the <select name=state> tag? or do i put it in an onClick in the state select tag?
and secondly, do i need to make this a function?
the way i want it to behave is like this -- the state dropdown will appear below the country dropdown. as the above code should be "live" at all times, by default, the state dropdown would be disabled, until the user selects either USA or Canada, at which point the state field will be disabled = false.
how might i go about this?
thanks for your time and help.
i have two simple dropdowns on my signup page. one is for state, the other for country. i'm using php/mysql to populate the <option> tags, but i guess for the sake of my question that might not be important.
what i want to do is simply disable the STATE dropdown when the COUNTRY dropdown field != USA && != Canada:
if (document.submit_signup.country.value != "USA && document.submit_signup.country.value != "Canada" {
document.submit_signup.state.disabled = true;
}
i'm quite new to js, so i'm not quite certain about where / how this snippet of code can be placed. ie, do i put it at the top of the page with my other functions? or do i put just below the <select name=state> tag? or do i put it in an onClick in the state select tag?
and secondly, do i need to make this a function?
the way i want it to behave is like this -- the state dropdown will appear below the country dropdown. as the above code should be "live" at all times, by default, the state dropdown would be disabled, until the user selects either USA or Canada, at which point the state field will be disabled = false.
how might i go about this?
thanks for your time and help.