why validation fails if using custom component inside a datatable?
I have a very strange problem.
The required validation inside a datatable works great if I am working directly with the original components for instance:
<ice:inputText id="inputTextt" field="#{bean[fieldValue]}" required="true"/>
<ice:message for="inputTextt"></ice:message>
will raise the required message when I press the button to POST the form.
Well, I have a custom component gra:inputTextValidated where I put the same stuff but a little bit more complex:
<ice:inputText
id="#{id}"
value="#{bean[field]}"
rendered="#{rendered and empty validatorBean}"
styleClass="#{styleClass} #{not required ? 'graNotRequired':''}"
style="width: #{width};height:#{height}"
partialSubmit="#{partialSubmit}"
disabled="#{disabled}"
required="#{required}">
</ice:inputText>
<ice:message
styleClass="graValidationMessage graNotRequired"
for="#{id}" />
so now, from the datatable I am calling my component like:
<gra:inputTextValidated
id="inputText"
bean="#{bean}"
field="#{fieldValue}"
renderLabel="false"
required="true"
disabled="#{disabled}"
width="90%"
开发者_JS百科 height="#{secondTabComponentsHeight}"
>
</gra:inputTextValidated>
Now the validation message no longer occurs. The gra:inputTextValidated component works fine, the value is rendered so it's only a problem about validation.
I've spent about 3 hours on this and I am extremely sure it's something about the ids, somehow the for attribute of the ice:message does not correctly see my input text from the custom component (but it is there, rendered as a spam).
Do you have any suggestion?
Solved.
The above code is working.
精彩评论