[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-432) Support @IfInvalid functionality without @IfInvalid

Norman Richards (JIRA) jira-events at jboss.com
Sun Dec 17 14:24:38 EST 2006


    [ http://jira.jboss.com/jira/browse/JBSEAM-432?page=comments#action_12348908 ] 
            
Norman Richards commented on JBSEAM-432:
----------------------------------------

I'm trying to understand the motivation, so let's look at the example here.  The way I am interpreting this is that Christian wants to be able to go "back" without failing because a user entered a poorly formed email address or something.    Since this are string values, we want the values to go straight into the model without model validation, but they still go through JSF validation, even if you don't configure any JSF constraints.

First, required="true" would cause this to not work.  If you don't put require="true", then s:validateAll will to correctly validate missing fields later.  You'll get an error when you try to commit the transaction, which I don't think is anything close to a desired behavior.  

Second, what happens with a numeric field here?  If you enter "random text" and then go to profile, you will fail at conversion and will not be able to go back.   And, if you can always hit back successfully, what's the whole point?    Let's suppose you could bypass this, where do you store the value?  On the int field in the model?  No - the only place I can see this data making sense is in the UI model.  

In my mind, the JSF solution works well.  immediate=true bypasses processing of the submitted data, leaving it on the UI model for future use.  

I can't quite nail down a reasonable use case for deferred model validation, but I suppose I can imagine that one might exist.  I just can't see it as being generally useful or interesting.

> Support @IfInvalid functionality without @IfInvalid
> ---------------------------------------------------
>
>                 Key: JBSEAM-432
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-432
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: Core
>    Affects Versions: 1.1.0.BETA1
>            Reporter: Christian Bauer
>         Assigned To: Norman Richards
>             Fix For: 1.1.1.GA
>
>
> The "Previous Page" button has to Update Model Values, but not Process Validations:
>             <h:form>
>                 <f:facet name="beforeInvalidField">
>                     <h:graphicImage value="/img/attention.gif"
>                                     width="18" height="18"
>                                     styleClass="attentionImage"/>
>                 </f:facet>
>                 <f:facet name="afterInvalidField">
>                     <s:message/>
>                 </f:facet>
>                 <f:facet name="aroundInvalidField">
>                     <s:span styleClass="errors"/>
>                 </f:facet>
>                 <div class="errors" align="center">
>                     <h:messages globalOnly="true"/>
>                 </div>
>               <s:validateAll>
>                 <div class="entry">
>                     <div class="label">#{messages['Firstname']}:</div>
>                     <div class="input">
>                         <s:decorate>
>                             <h:inputText size="32" required="true"
>                                          value="#{register.user.firstname}"/>
>                         </s:decorate>
>                     </div>
>                 </div>
>                 <div class="entry">
>                     <div class="label">#{messages['Lastname']}:</div>
>                     <div class="input">
>                         <s:decorate>
>                             <h:inputText size="32" required="true"
>                                          value="#{register.user.lastname}"/>
>                         </s:decorate>
>                     </div>
>                 </div>
>                 <div class="entry">
>                     <div class="label">#{messages['Email']}:</div>
>                     <div class="input">
>                         <s:decorate>
>                             <h:inputText size="32" required="true"
>                                          value="#{register.user.email}"/>
>                         </s:decorate>
>                     </div>
>                 </div>
>                 <div class="entry">
>                     <div class="label">&#160;</div>
>                     <div class="input">
>                         <h:commandButton value="#{messages['PrevPage']}" styleClass="button"
>                                          action="register"/>
>                         <h:commandButton value="#{messages['NextPage']}" styleClass="button"
>                                          action="#{register.enterProfile}"/>
>                     </div>
>                 </div>
>             </s:validateAll>
>             </h:form>

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

        



More information about the seam-issues mailing list