You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Saifuddin Feroz Bhagat <Sa...@infosys.com> on 2004/10/30 03:51:01 UTC

Enabling/Disabling elements in jsp

Hello,
    I hv used multi box for an application. Now,the requirement is that
i have to make the multibox enable/disable depending on a value in my
data Object.
I hv a getter/setter in my data Object that will hv boolean value which
signifies enable/disable.
 
 <html:multibox  style="border:none;" property="dataObject.checkBox"
disabled="">
  <bean:write name="name" property="Id" /> 
 </html:multibox>
 
In the above code how do i give the diabled option.
 
Restriction:
    Cannot use logic: tags.
    Cannot use bean:write.
    Hv to use html: ,cannot create a new tag class.
 
 
Saifuddin

Re: Enabling/Disabling elements in jsp

Posted by ja...@wendysmoak.com.
Saifuddin
> I hv used multi box for an application. Now,the requirement is that
> i have to make the multibox enable/disable depending on a value in my
> data Object.
> I hv a getter/setter in my data Object that will hv boolean value which
> signifies enable/disable.
>
>  <html:multibox  style="border:none;" property="dataObject.checkBox"
> disabled="">
>   <bean:write name="name" property="Id" />
>  </html:multibox>
>
> In the above code how do i give the diabled option.
>
> Restriction:
>     Cannot use logic: tags.
>     Cannot use bean:write.
>     Hv to use html: ,cannot create a new tag class.

Why can't you use logic tags?  Then you say you can't use <bean:write> yet
you've used it in your example above.  Fine.  If <logic:> isn't allowed...
use JSTL:  <c:if> ;)

Can you use the Struts-EL tags that take expressions (or a container that
evaluates them?)  Then you could do disabled="${someObj.prop}".

For some reason, I don't trust all browsers to respect the 'disabled'
attribute, so when I need to disable something I either show it as text,
or else a disabled form element with a property name that gets ignored in
the Action.  That way if it does get submitted it won't hurt anything.

-- 
Wendy Smoak

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org