This topic is locked

Disable Fileds based on Option selected

3/26/2009 12:08:08 PM
ASPRunnerPro General questions
S
sunnynayak author

Hi,

I have created a form which will be used to evaluate trainers.
I have a dropdown field "Trainer Type" and options are "Permanent" and "Temporary".
I have 20 questions where i can rate a Permanet trainer on, but for the Temporary trainer i need only 10 questions.
How can i disable the 10 questions lets assume question1 to question10 based on the option selected as "Temporary" in the Trainer Type field.
Help will be appreciated.
regards,

Sunil

S
sunnynayak author 3/26/2009

I figured this one out...

I used the following script to disable 2 fields namely "Field1" and "Field2"
These 2 fields will get disabled if the "Name" field has the value IJP selected.

<script>

document.forms.editform.value_Name.onchange=function()

{

if(this.options[this.selectedIndex].value=='Existing')

document.forms.editform.value_Field1.disabled=false;

else

{

document.forms.editform.value_Field1.disabled=true;

document.forms.editform.value_Field1.value='';

}

{

if(this.options[this.selectedIndex].value=='Existing')

document.forms.editform.value_Field2.disabled=false;

else

{

document.forms.editform.value_Field2.disabled=true;

document.forms.editform.value_Field2.value='';

}

}

}

</script>