I have a text box where people enter the title of a book. If a title is entered the MUST choose if they are the author or not. I don`t know how to do the MUST part. If the "title" box is empty they have nothing to do with the radio buttons. If "title" is there, they must choose if they are "author" or "not author". It would be great if we could also show the radio buttons only if a title is entered.
Below is a simple example of how this is done, other validation can be done during the server-side processing. <input type="text" id="txtTitle" onkeyup="textChange();"/><br /> <table id="buttons" style="visibility: hidden;"> <tr><td> <input type="radio" name="isAuthor" value="is" />Author<br /> <input type="radio" name="isAuthor" value="isnt" checked />Not Author<br /> </td></tr> </table> <script type="text/javascript" > function textChange() { if (txtTitle.value == "") buttons.style.visibility = "hidden"; else buttons.style.visibility = "visible"; setTimeout("textChange()",2500); } </script> Code (markup):