document.forms[0].FIELDNAME.disabled=true;
EXAMPLE:
This code example hides the four fields based on which value has been selected in the combobox field.
//determine which option has been selected for "sourcetype"
for ( i=0 ; i<document.forms[0].sourcetype.length ; i++ ){
if (document.forms[0].sourcetype.options[i].selected == true) {
sourcetypevar = document.forms[0].sourcetype.options[i].text
}
}
if (sourcetypevar == "Consulting for Company") {
document.forms[0].HomeCountry.disabled=true
document.forms[0].HostCountry.disabled=true
}
else if (sourcetypevar == "Please select") {
document.forms[0].HomeCountry.disabled=true
document.forms[0].HostCountry.disabled=true
document.forms[0].TaxYear.disabled=true
document.forms[0].ServiceDescription.disabled=true
}
else {
document.forms[0].HomeCountry.disabled=false
document.forms[0].HostCountry.disabled=false
document.forms[0].TaxYear.disabled=false
document.forms[0].ServiceDescription.disabled=false
}