• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

How to make an item in a picklist unselectable ?

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
something looks simple but just no knowledge yet --

************
<FORM ACTION=".....">
.....
Month: <SELECT NAME="mon" SIZE="2">
<OPTION VALUE="00"> average
<OPTION VALUE="01"> January
<OPTION VALUE="06"> June
<OPTION VALUE="11"> Nov
<OPTION VALUE="12"> Dec

</SELECT>
....
</FORM>
************

I just want the first item "average" become

1) either it is NOT selectable
2) or if you select it and press SUBMIT button, it will be ignored in the "ACTION" (i.e. you won't be able to retrieve its value from the "mon" parameter). But other items won't be ignored if they are selected

between 1) and 2), I prefer 1). But if 1) is impossible, 2) is OK.

Please help.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can not mkae it unselecteable, unless you run a script that validates the field stating that you need to select an option from the list. (Why include the option in the first place if it is not used?)

Eric

Why don't you just handle it on the server? Rather simple if statement in my eyes.

Eric
 
Frank Sikuluzu
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:
You can not mkae it unselecteable, unless you run a script that validates the field stating that you need to select an option from the list. (Why include the option in the first place if it is not used?)

Eric

Why don't you just handle it on the server? Rather simple if statement in my eyes.

Eric





Give you a concrete example :

I want to display a picklist like following

*************************
Deli Department
ham
cheese
potato
Seafood Department
rock fish
crab
lobster
*************************

But I only want users to pick the real item instead of "Seafood Department" or "deli dept" which is use to group the items. So, any idea we can handle from front ? I know it can be manipulated on server.
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try the "optgroup" element. View the spec .

andrew
 
Frank Sikuluzu
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andrew Eccleston:
Try the "optgroup" element. View the spec .

andrew



This sounds like an excellent idea. In the following example --

**************
<OPTGROUP label="PortMaster 3">
<OPTION label="3.7.1" value="pm3_3.7.1">PortMaster 3 with ComOS 3.7.1</OPTION>
<OPTION label="3.7" value="pm3_3.7">PortMaster 3 with ComOS 3.7</OPTION>
<OPTION label="3.5" value="pm3_3.5">PortMaster 3 with ComOS 3.5</OPTION>
</OPTGROUP>
**************

Can I omit the "label=" for the <OPTION> tag ? I know "value" is useful for future information retrieval. Is "label" important ? Of course, it seems to be essential for <OPTGROUP>, but is it eseential for <OPTION> ?
 
Andrew Eccleston
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what I see of your list, you should be able to omit the label in the OPTION tag. I think that the OPTION tag only needs the label attribute in more complicated lists. I personally have not had any problems with removing it.

andrew
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic