Hiding options in drop down boxes, I'm stuck. How the heck do you.... |
Hiding options in drop down boxes, I'm stuck. How the heck do you.... |
code2319 |
Sep 29 2006, 09:18 AM
Post
#1
|
Group: Members Posts: 1 Joined: 29-September 06 Member No.: 274 |
Good morning from Missouri!!!
I just signed up with HTMLHelp.com this morning after battling a coding issue for an hour. I am trying to group like terms in a drop down box and separate them using '---------------' values. Here's an example of what the drop down box would look like: Database Table View ----------------- Element File Record IDMS ----------------- Program Copybook Using HTML, can you mask the '--------------------' values so that they are not clickable for selection? So that they are for display purposes only? Here's my code: <table> <form method="post" action="resultsMetaData.do" name="form1" onSubmit="showProcessing();"> <tr> <td align=center><label for="searchtype">Search Type</label></td> <td align=center><label for="searchterm">Search Term</label></td></tr> <tr> <td><SELECT NAME="searchtype"> <OPTION>Database</OPTION> <OPTION>Table</OPTION> <OPTION>View</OPTION> <OPTION>---------------</OPTION> <OPTION>Element</OPTION> <OPTION>File</OPTION> <OPTION>Record</OPTION> <OPTION>IDMS</OPTION> <OPTION>---------------</OPTION> <OPTION>Program</OPTION> <OPTION>Copybook</OPTION> <OPTION>Record Copybook</OPTION> <OPTION>---------------</OPTION> <OPTION>Glossary</OPTION> </SELECT></td> <td><input type="text" name="searchterm" size="20" maxlength="255" value="" /> </td> <td><input type="submit" name="submit1" value="Search"></td> </tr> </form> </table> Any help would be appreciated! I'm looking through manuals now also. And we all know how exciting that can be.... HA! This post has been edited by code2319: Sep 29 2006, 09:20 AM |
Sparkyg |
Sep 29 2006, 09:27 AM
Post
#2
|
Member Group: Members Posts: 46 Joined: 29-September 06 From: Suffolk UK Member No.: 270 |
Hi There
Within the showProcessing() function you need to check the value of searchtype, and return false if it is equal to '---------', that then stops the form being submitted cheers Sparky |
Christian J |
Sep 29 2006, 11:06 AM
Post
#3
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
QUOTE Using HTML, can you mask the '--------------------' values so that they are not clickable for selection? So that they are for display purposes only? With HTML you might use the OPTION element's DISABLED attribute, but IE doesn't support it. Javascript might be used as a workaround, but make sure the server-side script works even if a user without javascript submits "-----------------". |
Brian Chandler |
Sep 29 2006, 12:16 PM
Post
#4
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
Good morning from Missouri!!! I just signed up with HTMLHelp.com this morning after battling a coding issue for an hour. I am trying to group like terms in a drop down box and separate them using '---------------' values. Here's an example of what the drop down box would look like: Database Table View ----------------- Element File Record IDMS ----------------- Program Copybook Using HTML, can you mask the '--------------------' values so that they are not clickable for selection? So that they are for display purposes only? Here's my code: <table> <form method="post" action="resultsMetaData.do" name="form1" onSubmit="showProcessing();"> <tr> <td align=center><label for="searchtype">Search Type</label></td> <td align=center><label for="searchterm">Search Term</label></td></tr> <tr> <td><SELECT NAME="searchtype"> <OPTION>Database</OPTION> <OPTION>Table</OPTION> <OPTION>View</OPTION> <OPTION>---------------</OPTION> <OPTION>Element</OPTION> <OPTION>File</OPTION> <OPTION>Record</OPTION> <OPTION>IDMS</OPTION> <OPTION>---------------</OPTION> <OPTION>Program</OPTION> <OPTION>Copybook</OPTION> <OPTION>Record Copybook</OPTION> <OPTION>---------------</OPTION> <OPTION>Glossary</OPTION> </SELECT></td> <td><input type="text" name="searchterm" size="20" maxlength="255" value="" /> </td> <td><input type="submit" name="submit1" value="Search"></td> </tr> </form> </table> Any help would be appreciated! I'm looking through manuals now also. And we all know how exciting that can be.... HA! Another Really Simple answer might be to separate them by *blank* entries. The blank will probably be ignored naturally if your script is reasonably robust. Well, this won't work if you _require_ the input. |
pandy |
Sep 29 2006, 09:43 PM
Post
#5
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
You could use OPTGROUP and its LABEL attribute. It may or may not be possible to style the label in different browsers.
http://www.htmlhelp.com/reference/html40/forms/optgroup.html |
Lo-Fi Version | Time is now: 19th April 2024 - 08:16 AM |