Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2003
    Location
    Singapore
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combobox indexOf Error

    I'm using the following code below:

    Code:
    var f = document.forms[0];
    var specialRm = f.RoomSelection.options[f.RoomSelection.selecedIndex].text;
    var chkIndex = specialRm.indexOf('(*)')
    
    if (chkIndex == -1)
    	{
    		f.CoBrochures.style.visibility = 'visible';
    		for (i = 0; i < f.SpecialArrangements.length; i++)
    		{
    			f.SpecialArrangements[i].style.visibility = 'visible';
    		}
    
    		f.OtherArrangement.style.visibility = 'visible';
    		for (i = 0; i < f.VideoLanguage.length; i++)
    		{
    			f.VideoLanguage[i].style.visibility = 'visible';
    		}
    	}
    
    else
    {
    	f.CoBrochures.style.visibility = 'hidden';
    	for (i = 0; i < f.SpecialArrangements.length; i++)
    	{
    		f.SpecialArrangements[i].style.visibility = 'hidden';
    	}
    	
    	f.OtherArrangement.style.visibility = 'hidden';
    	for (i = 0; i < f.VideoLanguage.length; i++)
    	{
    		f.VideoLanguage[i].style.visibility = 'hidden';
    	}
    }
    However, I can't seem to make it work. It keeps telling me that RoomSelection.options[...] is null or not defined.

    I got too many options in the combobox called RoomSelection and some of the options contain (*) Meeting Room 1, (*) Meeting Room 2 & so on.

    How should I modify the code so that it hides/unhide correctly?

  • #2
    New Coder
    Join Date
    Aug 2003
    Location
    Singapore
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There wasn't anything wrong. Just some typo.

    var specialRm = f.RoomSelection.options[f.RoomSelection.selecedIndex].text;


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •