Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Disabling Multiple Fields from Select Box


Message #1 by tdaustin@i... on Mon, 3 Feb 2003 04:09:59
Try following the syntax of the language :

><script>
>function Disable1()
>{
>         if (document.OnlineApplication.LAStatus.value!='Own / Buy')

         {

>                 document.OnlineApplication.LAPeriodYears.disabled=true;

         }

>         else

         {

>                 document.OnlineApplication.LAPeriodYears.disabled=false;
>         }
>         if (document.all)

         {

>                 setInterval("Disable1()",100);
         }

></script>


At 04:09 03/02/03 +0000, you wrote:
>Hi All,
>
>I am having problems with my little script that disables fields on the
>selection of the a Option they choose.
>
>I am extremely confused that the if statement can only handle 1 line of
>code.  Is this how js works.  I have a very large insurance form and i
>want to disable the field regarding mortage repayments if not selected.
>
>It all works from a select menu with options of Living arangements.
>
>It all works fine for one field item. How do i do my if statement to
>exludes the other fields.
>
>How come i cant just include the other fields after
>document.OnlineApplication.LAPeriodYears.disabled=true
>document.OnlineApplication.ANYFIELDILIKE.disabled=true
>
>And it should disable them???
>
>Thank in Advance
>Tim
>
>Here is my code
>
><script>
>function Disable1(){
>if (document.OnlineApplication.LAStatus.value!='Own / Buy')
>document.OnlineApplication.LAPeriodYears.disabled=true
>else
>document.OnlineApplication.LAPeriodYears.disabled=false
>}
>if (document.all)
>setInterval("Disable1()",100)
></script>




  Return to Index