Hello,

I want a hidden input field with a default value put in JSF page. The value that the input field is tied to is of type 'ContentType' (object), so I use a converter to convert the string to the object as:

<h:inputHidden value="#{contentForm.content.type}" id="type" >
   <f:converter converterId="converters.ContentTypeConverter"  />
</h:inputHidden>

Since the inputHidden is bound to "contentForm.content.type" by virtue of me assigning it to the value attribute, and since the content.type by default is null, so the input is rendered as:

<input id="contentForm:type" type="hidden" value="" name="contentForm:type"/>

note: value="" I would like to have it defaulted to value="MENU_ITEM" as:

<input id="contentForm:type" type="hidden" value="MENU_ITEM" 
name="contentForm:type"/>

but, if I change the h:inputHidden to value="MENU_ITEM", I do get the desired input tag, but the value is not then assigned to content object upon submission.

So, if I use value="contentForm.content.type", I do get proper linking with backing bean properties, but NO default value. and I if provide a text value like value="MENU_ITEM", I do get the proper default value, but I do NOT get the linking with backing bean. How can this be resolved?

Thanks
MRather

Reply via email to