stockton Posted August 31, 2009 Share Posted August 31, 2009 In the following code I am attempting to get certain fields to only appear if the user Selects dependent else those fields should be hidden. Please tell me what I have done wrong? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>Display and Hide</title> <script language="JavaScript"> function showhidefield() { if (document.HelpAdd.RecordType.value == "Parent") { document.getElementById("hideablearea").style.visibility = "hidden"; } else { document.getElementById("hideablearea").style.visibility = "visible"; } } </script> </head> <body> <form name='HelpAdd' action='nextpage.asp'> <table align="center" border="3" cellspacing="0" cellpadding="3"> <tr><td>Record Type:</td> <td><select id="RecordType" name="RecordType" onchange=showhidefield()> <option value='0'>Parent</option> <option value='1'>Dependant</option><br/> <tr><td>Topic Title:</td> <td><input type="text" name="TopicName" ID="TopicName" maxlength="25"></td></tr> <div id='hideablearea' style='visibility:hidden;'> <tr><td>Parent:</td> <td><select name="Parent"> <input type="text" name="ParentID" ID="ParentID" maxlength="25"></td></tr> <tr><td>Topic Body:</td> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $MaxFileSize ?>" /> <td><input id="helpfile" name="helpfile" type="file" /></td></tr> </div> <tr><td colspan="2" align="center"> <input type="submit" name="submit" value="Submit"> <a href="/help.php"><button>Back</a> </td></tr> <tr><td colspan="2" align="center"> <?php echo $Message ?> </td></tr> </table> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.