Well, this is very unpleasant, and it is probably very simple. I want to launch my web page with the checkboxes disabled, and after the participant’s row in the list is selected in them, select these fields. So I put this in the onload method
onload = function () { for (i = 0; i < document.frmMain.checkgroup.length; i++){ document.frmMain.checkgroup[i].disabled = true ; } }
it will launch my page with disabled blocks, now I want to enable them
function enableCheckboxes(){ if (document.frmMain.Vrste[document.frmMain.Vrste.selectedIndex].value == "Sendvici i Rostilj"){ for(i=0;i<document.frmMain.checkgroup.length;i++){ document.frmMain.checkgroup[i].enabled = true; } } }
it enters the for loop, but never includes these flags. I can’t understand why.
and this is the html part where I call the checkcheckbox function:
<select name="Vrste" onChange="PopulatePodvrste(); enableCheckboxes();" size="8"> <option value="Pica">Pica</option> <option value="Barbarina domaca trpeza">Barbarina domaca trpeza</option> <option value="Slana Palacinka">Slana Palacinka</option> <option value="Slatka Palacinka">Slatka Palacinka</option> <option value="Sendvici i Rostilj">Rostilj i sendvici</option> <option value="Dobro jutro sa Barbarom">Dobro jutro sa Barbarom</option> <option value="Chicken Meni">Chicken Meni</option> <option value="Posebna Ponuda">Posebna Ponuda</option> <option value="Salate">Salate</option> </select>
And finally, the actual flags:
<input type="checkbox" name="checkgroup" >Susam</input><br> <input type="checkbox" name="checkgroup" >Cili</input><br> <input type="checkbox" name="checkgroup" >Tartar</input><br> <input type="checkbox" name="checkgroup" >Urnebes</input><br> <input type="checkbox" name="checkgroup" >Krastavac</input>
source share