I found out that this related to the validation. The field of the inputHidden 
is not lost.

The code for inputHidden is:
<h:inputHidden id="version" value="#{userForm.user.version}">
This component works correct.

But something like:
<h:outputText value="Version: #{userForm.user.version}" />
wont work as expected

If I submit the form and some other required field is not provided, the 
validation fails, then userForm.user.version is NULL for the component 
<h:outputText> but <h:inputHidden> is rendered with the correct value 
(userForm.user.version != NULL). Eg the HTML sourcecode after failing 
validation is something like

<input type="hidden" id="userForm:version" name="userForm:version" value="3" />
Version: 

Where I expect it to be:

<input type="hidden" id="userForm:version" name="userForm:version" value="3" />
Version: 3

I guess it has something to do with some other libraries I am using. Any 
suggestions where I should start searching? Or could you recommend to replace 
all inputHidden with saveState?

Thanks
René



-----Ursprüngliche Nachricht-----
Von: Rene Guenther [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 11. Dezember 2007 10:53
An: [email protected]
Betreff: Re: inputHidden and disabled form fields are lost




> ---- "René Günther" <[EMAIL PROTECTED]> schrieb:
>> I am updating an object with a JSF form. I got some inputHidden fields
>> and
>> one selectOneMenu which is disabled when I update (instead of adding) the
>> object. I got some required fields. If I clear the content of a required
>> field and submit the form, the values of inputHidden fields and of the
>> disabled selectOneMenu are lost in the response. If I just update some
>> data
>> without omitting a required field everything works fine: so the setter
>> methods seem to work but when rendering the response after validation
>> errors, the getter methods for the inputHidden fields return null.
>> 
>> Any suggestions what I could do?
>> 
> 
> I'm not sure what is happening with your hidden fields. Those are not
> marked "disabled" are they?
> 
> 

I forgot about the side effects of the disabled property. But the hidden
fields are not disabled and they only get lost when validation errors occur.
If I "replace" inputHidden with saveState it works.

Regards
René


-- 
View this message in context: 
http://www.nabble.com/inputHidden-and-disabled-form-fields-are-lost-tp14269886p14270828.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to