That's cool. I never thought of that...

-----Original Message-----
From: Lance [mailto:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to