hi, i've got a javascript that checks an input field in a form if that field is filled correctly, but now i only want to do that check if a radiobutton above in the field stands in "yes", is there a way to do that?
cheers!
/Måns
| SitePoint Sponsor |
hi, i've got a javascript that checks an input field in a form if that field is filled correctly, but now i only want to do that check if a radiobutton above in the field stands in "yes", is there a way to do that?
cheers!
/Måns





if (document.yourForm.yourRadioButton.value == "yes"){
checkInputField()
}
thanks mate! worked like a charm!
/Måns
came back to work now on monday, and it didnt work anymore...
it seems like since i have two radiobuttons, both with the same name (since im passing their value as a variable), the script gets confused and dont know which button to check... or something, im just guessing since javascripting really isnt my area... anyways, here's the code, anybody who knows how to fix this problem?
Code:Block description done:<br> <?php if ("yes" == $row["block_description"]) { ?> Yes: <INPUT TYPE="RADIO" NAME="block_description" VALUE="yes" CHECKED> No: <INPUT TYPE="RADIO" NAME="block_description" VALUE="no"> <? } else { ?> Yes: <INPUT TYPE="RADIO" NAME="block_description" VALUE="yes"> No: <INPUT TYPE="RADIO" NAME="block_description" VALUE="no" CHECKED> <? } ?> <script language="JavaScript"> <!-- function isValidDate4() { if (document.update.block_description.value == "yes") { var dateStr = document.update.block_description_date.value; blah blah code code } } --> </script> <br>If yes, then: Block description date (YYYY-MM-DD):<br> <INPUT TYPE="TEXT" NAME="block_description_date" VALUE="<?php echo($row["block_description_date"]); ?>" SIZE="40" onBlur="isValidDate4()"><br>
anybody?
i tried to replace the radiobuttons with a dropdown, like this but that doesnt seem to work either...
Code:Block description done:<br> <? if ( yes == $row["block_description"] ) { ?> <SELECT name="block_description"> <option selected>yes <option>no </SELECT><br> <? } else { ?> <SELECT name="block_description"> <option>yes <option selected>no </SELECT><br> <? } ?>
Bookmarks