Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

html:select disabled property not working

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

In my struts application, I would like to disable / enable an html:select box based on values selected from another html:select. I am using the following code for enable / disable.

<bean efine id="myForm" name="myActionForm" type="org.myproj.view.myActionForm" />

<html:select property="select_name" size="1"
disabled='<bean:write name="myForm" property="disableNameFlag"/>' onchange="findAge()">

<html ption value="0">--- Select ---</html ption>

<logic resent name="myActionForm" property="childNameList">
<html ptionsCollection name="myActionForm" property="childNameList"/>
</logic resent>
</html:select>

I am setting the value of disableNameFlag to true in the action form bean and <bean:write name="myForm" property="disableNameFlag"/> prints value as true. But html:select is not disabled. Please help.

Thanks.

roshni
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm thinking the issue is probably that the bean:write tag isn't evaluated in that disabled attribute. To be sure you could look at the source html of the select tag to see if the disabled attributed is set to true or if its set to the string <bean:write name="myForm" property="disableNameFlag"/>. If this is the problem you could use the value of your disableNameFlag in a logic:equal tag to control what gets set in the disabled property.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't nest tags like that--you need to either use an rtexpr or JSP EL, or as Tom said use logic to determine what gets put in there.
 
Surfs up space ponies, I'm making gravy without this lumpy, tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic