s:validateAll in custom tag/template
blackers May 23, 2007 9:25 PMI am using seam 1.2.1GA and Jboss 4.0.5GA and am experiencing a problem when I try to use s:validate when the form fields are contained in a custom tag.
my calling page calls a custom tag that I have created that contains a group of common form fields that I would like to reuse across many pages.
<s:validateAll> <tt:basicCRMFields title="#{signUp.title}" firstName="#{signUp.firstName}" lastName="#{signUp.lastName}" country="#{signUp.country}" email="#{signUp.email}" confirmEmail="#{signUp.confirmEmail}"/> </s:validateAll>
the tag works fine as far as passing the data to my seam components but validation does not occur.
my tag .xhtml file looks like the following.
<s:decorate id="titleDecoration" template="../../templates/decorateFormField.xhtml"> <ui:define name="label">Title:</ui:define> <ui:define name="field"> <tt:salutationList id="title" value="#{title}" required="true"> </tt:salutationList> </ui:define> </s:decorate> <s:decorate id="firstNameDecoration" template="../../templates/decorateFormField.xhtml"> <ui:define name="label">First Name:</ui:define> <ui:define name="field"> <h:inputText id="firstName" value="#{firstName}" required="true"> </h:inputText> </ui:define> </s:decorate> <s:decorate id="lastNameDecoration" template="../../templates/decorateFormField.xhtml"> <ui:define name="label">Last Name:</ui:define> <ui:define name="field"> <h:inputText id="lastName" value="#{lastName}" required="true"> </h:inputText> </ui:define> </s:decorate> <s:decorate id="countryDecoration" template="../../templates/decorateFormField.xhtml"> <ui:define name="label">Country:</ui:define> <ui:define name="field"> <tt:countryList id="country" value="#{country}" required="true"> </tt:countryList> </ui:define> </s:decorate> <s:decorate id="emailDecoration" template="../../templates/decorateFormField.xhtml"> <ui:define name="label">Email:</ui:define> <ui:define name="field"> <h:inputText id="email" value="#{email}" required="true"> </h:inputText> </ui:define> </s:decorate> <s:decorate id="emailConfirmDecoration" template="../../templates/decorateFormField.xhtml"> <ui:define name="label">Confirm Email:</ui:define> <ui:define name="field"> <h:inputText id="confirmEmail" value="#{confirmEmail}" required="true"> </h:inputText> </ui:define> </s:decorate>
Should it be possible that seam will validate my fields when used in this way? It makes no difference if I add the s:validateAll to the tag .xhtml template file, validation still does not occur. if I move one of the s:decorate fields directly into the calling file the validation works. Is this the expected behavior?
Thanks
Mat