[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-4483) <s:validateAll/> doesn't perform hibernate model validations if manual control validator assigned

Vitaliy Tkachenko (JIRA) jira-events at lists.jboss.org
Mon Nov 23 11:37:36 EST 2009


<s:validateAll/> doesn't perform hibernate model validations if manual control validator assigned
-------------------------------------------------------------------------------------------------

                 Key: JBSEAM-4483
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4483
             Project: Seam
          Issue Type: Bug
          Components: JSF Controls
    Affects Versions: 2.1.1.GA
         Environment: Windows 7 + IE 8
            Reporter: Vitaliy Tkachenko


formField.xhtml:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib">
	<div class="decorated">
		<s:label styleClass="name #{overiddenStyle} #{invalid?'errors':''}">
			<ui:insert name="label" />
			<s:span styleClass="required" rendered="#{required}">*</s:span>
		</s:label>
		<span class="value #{invalid?'errors':''}">
		<s:validateAll>
			<ui:insert />
		</s:validateAll>
		</span>
		<span class="error">
			<h:graphicImage value="/img/error.gif" rendered="#{invalid}" styleClass="errors" />
			<s:message id="message" styleClass="errors" />
		</span>
	</div>
</ui:composition>

Using formField.xhtml:
	<s:decorate id="userNameField" template="/includes/formField.xhtml">
		<ui:define name="label">#{messages.login_username}</ui:define>
		<h:inputText id="userName" required="true"
			value="#{selectedUser.userName}" size="25" maxlength="50"
			readonly="#{not verifyUserAction.registeringUser}"
			validator="#{verifyUserAction.verifyUserName}">
			<a:support event="onblur" reRender="userNameField" ajaxSingle="true"
				bypassUpdates="true" />
		</h:inputText>
	</s:decorate>

selectedUser.userName in the model:
	@Column(name = "user_name", unique = true, nullable = false, length = 50)
	@NotNull
	@Length(min = 4, max = 50)
	@UserPrincipal
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

Seam in this case doesn't validate the user name control entry accordingly to "@Length(min = 4, max = 50)" for example and let's submit 3 characters length value, hibernate exception follows on the store procedure.

If the [validator="#{verifyUserAction.verifyUserName}] is cut from the userName field the model validation will be performed.

There is a hack for this case: <s:validate/> can be added too into the userName control and both hibernate and manual validators will be executed during the validation procedure.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list