• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

disable option tag

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried diabling the option collection tag but cant get it . I was able to disable the <html:select> by disable="true" but this attribute is not working for the <option collection.

Please give me a solution for this.

Thanks in advance.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, jayanthi, you can't disable a single option in a select box. The entire select box is either enabled or disabled.

If you need to make sure a user doesn't select a specific option, you have two choices:

1-Use server-side logic to make sure the offending option is not included in the option list when the page is generated.
2-Use JavaScript on the client-side to remove the option from the list of options if a particular condition exists or user action is taken. This can get tricky, because if the user changes his/her mind, you may have to put the option back again.
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Disabled is attribute of struts html's option tag. This attribute is not available for options & optionsCollection tag's. The biggest trouble is option disabled attribute is not browser compatible. IE does not support disabled attribute for select element where as Firefox supports it.

If you want to disable the options then you have to use logic:iterate, logic:equal and html: option together to disable certain options.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Purushothaman. I learned something new today. I'll have to play around with Firefox's support of disabling a single option.

It's great that Firefox supports it, but the fact that the most popular browser does not support it seems like a pretty big drawback to me. Unless you are writing an intranet application where Firefox is the only browser supported, I wouldn't use it.
[ July 31, 2006: Message edited by: Merrill Higginson ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic