Hi Simon,
thanks for your hint to use readonly instead. I played now a little with it and
the values are sent back to the server (they are listed in the
requestParameterMap). But it looks like it is not possible to use an input
component that are declared as readonly together with an valueChangeListener?
Example:
<h:inputText id="stringValue" value="#{property.stringValue}"
valueChangeListener="#{bean.propertyValueChanged}" readonly="true"/>
The propertyValueChanged listener will never get invoked ... if this the normal
behavior or maybe i do something wrong?
Before i submit the form, the field will set to input.readOnly = false; via
javascript.
Thanks,
Luca
I use myfaces-1.1.6 with tomahawk-1.1.8 and facelets-1.1.14
-------- Original-Nachricht --------
> Datum: Fri, 16 Jan 2009 21:37:53 +0100
> Von: Simon Kitching <[email protected]>
> An: MyFaces Discussion <[email protected]>
> Betreff: Re: Input components with disabled=true
> On Thu, 2009-01-15 at 20:28 +0100, Luca Graf wrote:
> > Hello together,
> >
> > I got an problem with input components like <h:selectBooleanCheckbox>
> when i use the attribute disabled=true. My scenario is that i have two
> checkboxes. The second is initially set to disabled=true. Now the user should
> only get access to the second if he changed the value of the first before.
> >
> > My approach was, if the user changed the value of checkbox1 then i set
> the attribute of checkbox2 via javascript to disabled=false.
> >
> > Example:
> > <h:selectBooleanCheckbox id="checkbox1" onchange="var
> element=document.getElementById('checkbox2'); if(element.disabled)
> element.disabled = false;
> else element.disabled = true;">
> >
> > <h:selectBooleanCheckbox id="checkbox2" disabled="false"/>
> >
> > On the first it looks good, after the user has changed the value of the
> first checkbox, the second is now accessible via html.
> > But it looks that the value is doesn't send in the request to the
> server, like the normal behavior for an input element with disabled=true.
> >
> > It is not enough to set disabled=false in HTML to get the value of
> checkbox2 to the server?
>
> Use "readonly" instead of "disabled". They appear the same to the user,
> but browsers send the state of "readonly" HTML elements back to the server on
> submit. Browsers ignore "disabled" HTML elements on submit, which is
> causing the problem.
>
> Regards,
> Simon
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen:
http://www.gmx.net/de/go/multimessenger