You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Megani <hj...@gmail.com> on 2007/04/18 16:35:32 UTC
Re: How to make a SELECT list readonly? If set disabled, loses the value when submit.
Hey, i was having the same problem...
i needed a <html:select that was read-only, but it had to forward it's id
to the action servlet populate the form bean with it.
i just declared a <html:hidden with the same property after it.
like:
<html:select property="id" disabled="true" >
(...)
</html:select>
<html:hidden property="id"/>
works fine ;)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: How to make a SELECT list readonly? If set disabled, loses the value when submit.
Posted by Frank Russo <Fr...@sas.com>.
That's cool. I never thought of that...
-----Original Message-----
From: Lance [mailto:lance.semmens@marketpipe.com]
Sent: Wednesday, April 18, 2007 10:56 AM
To: Struts Users Mailing List
Subject: Re: How to make a SELECT list readonly? If set disabled, loses the value when submit.
Another option is to make a disabled style in your css and blur onfocus
<html:select property="id" styleClass="disabled" onFocus="this.blur()">
:
</html:select>
Using a hidden element with the same name is slightly dodgy in that form.elements["id"] will return a different value depending if the hidden element is placed before or after the select.
Megani wrote:
> Hey, i was having the same problem...
> i needed a <html:select that was read-only, but it had to forward it's
> id to the action servlet populate the form bean with it.
>
> i just declared a <html:hidden with the same property after it.
>
> like:
>
> <html:select property="id" disabled="true" >
> (...)
> </html:select>
>
> <html:hidden property="id"/>
>
> works fine ;)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to make a SELECT list readonly? If set disabled, loses the
value when submit.
Posted by Lance <la...@marketpipe.com>.
Another option is to make a disabled style in your css and blur onfocus
<html:select property="id" styleClass="disabled" onFocus="this.blur()">
:
</html:select>
Using a hidden element with the same name is slightly dodgy in that
form.elements["id"] will return a different value depending if the
hidden element is placed before or after the select.
Megani wrote:
> Hey, i was having the same problem...
> i needed a <html:select that was read-only, but it had to forward it's id
> to the action servlet populate the form bean with it.
>
> i just declared a <html:hidden with the same property after it.
>
> like:
>
> <html:select property="id" disabled="true" >
> (...)
> </html:select>
>
> <html:hidden property="id"/>
>
> works fine ;)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org