You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ben Pryor <BP...@widen.com> on 2005/08/23 18:12:15 UTC

Validatable fields: should bound property be updated if in error?

Hi,

 I'm upgrading a large Tapestry 3 application to Tapestry 4.  One
unexpected behavior is that the new validation system appears to always
update a form component's bound property before doing validation and
recording any errors. There is a JIRA issue from July that mentions this
behavior (http://issues.apache.org/jira/browse/TAPESTRY-369). The
problem is that almost everywhere in our application     we expect the
bound property to only be updated if validation succeeds.

How do others handle this situation with the new validation? Should the
validation system be flexible enough to allow for sometimes updating the
bound property when in error and sometimes not?

Thanks,
 Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Validatable fields: should bound property be updated if in error?

Posted by Paul Ferraro <pm...@columbia.edu>.
I see your point.  I'm entering a jira issue for this now and will check 
in the appropriate changes sometime tonight.

Paul

Howard Lewis Ship wrote:

>Wow!  Didn't realize this big change. I think updates should not
>happen unless validations pass.  You run the risk of triggering
>unwanted validation exceptions *inside* your domain objects that will
>prevent normal form processing from operating.
>
>On 8/23/05, Paul Ferraro <pm...@columbia.edu> wrote:
>  
>
>>Ben is right.  Currently, values are bound only if translation succeeds
>>(this is essential), but before validation happens.
>>This was done purposefully to support "Save" style logic, since
>>validation errors can optionally be ignored in the triggered form
>>listener by ignoring the value of IValidationDelegate.getHasErrors().
>>I put this logic in place before the veto logic was implemented (I think
>>- although I work probably overlapped).  This is easy enough to change.
>>In 3.0, ValidField values could only be bound if and only if validation
>>succeeded since the old IValidators were responsible for both
>>translation and validation.
>>Since this limitation no longer exists, we have the option of binding
>>value either before or after the validators run.
>>
>>What are the advantages/disadvantages to each approach?
>>
>>Paul
>>
>>Howard Lewis Ship wrote:
>>
>>    
>>
>>>Validation does not work that way, not to my knowledge.  Even with the
>>>new validation, the translator and validators all have veto power, by
>>>throwing ValidationException, before an update occurs to the bound
>>>property.
>>>
>>>TAPESTRY-369 was a suggestion that was since judged invalid. It is not
>>>how Tapestry operates.
>>>
>>>On 8/23/05, Ben Pryor <BP...@widen.com> wrote:
>>>
>>>
>>>      
>>>
>>>>Hi,
>>>>
>>>>I'm upgrading a large Tapestry 3 application to Tapestry 4.  One
>>>>unexpected behavior is that the new validation system appears to always
>>>>update a form component's bound property before doing validation and
>>>>recording any errors. There is a JIRA issue from July that mentions this
>>>>behavior (http://issues.apache.org/jira/browse/TAPESTRY-369). The
>>>>problem is that almost everywhere in our application     we expect the
>>>>bound property to only be updated if validation succeeds.
>>>>
>>>>How do others handle this situation with the new validation? Should the
>>>>validation system be flexible enough to allow for sometimes updating the
>>>>bound property when in error and sometimes not?
>>>>
>>>>Thanks,
>>>>Ben
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Validatable fields: should bound property be updated if in error?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Wow!  Didn't realize this big change. I think updates should not
happen unless validations pass.  You run the risk of triggering
unwanted validation exceptions *inside* your domain objects that will
prevent normal form processing from operating.

On 8/23/05, Paul Ferraro <pm...@columbia.edu> wrote:
> Ben is right.  Currently, values are bound only if translation succeeds
> (this is essential), but before validation happens.
> This was done purposefully to support "Save" style logic, since
> validation errors can optionally be ignored in the triggered form
> listener by ignoring the value of IValidationDelegate.getHasErrors().
> I put this logic in place before the veto logic was implemented (I think
> - although I work probably overlapped).  This is easy enough to change.
> In 3.0, ValidField values could only be bound if and only if validation
> succeeded since the old IValidators were responsible for both
> translation and validation.
> Since this limitation no longer exists, we have the option of binding
> value either before or after the validators run.
> 
> What are the advantages/disadvantages to each approach?
> 
> Paul
> 
> Howard Lewis Ship wrote:
> 
> >Validation does not work that way, not to my knowledge.  Even with the
> >new validation, the translator and validators all have veto power, by
> >throwing ValidationException, before an update occurs to the bound
> >property.
> >
> >TAPESTRY-369 was a suggestion that was since judged invalid. It is not
> >how Tapestry operates.
> >
> >On 8/23/05, Ben Pryor <BP...@widen.com> wrote:
> >
> >
> >>Hi,
> >>
> >> I'm upgrading a large Tapestry 3 application to Tapestry 4.  One
> >>unexpected behavior is that the new validation system appears to always
> >>update a form component's bound property before doing validation and
> >>recording any errors. There is a JIRA issue from July that mentions this
> >>behavior (http://issues.apache.org/jira/browse/TAPESTRY-369). The
> >>problem is that almost everywhere in our application     we expect the
> >>bound property to only be updated if validation succeeds.
> >>
> >>How do others handle this situation with the new validation? Should the
> >>validation system be flexible enough to allow for sometimes updating the
> >>bound property when in error and sometimes not?
> >>
> >>Thanks,
> >> Ben
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Validatable fields: should bound property be updated if in error?

Posted by Paul Ferraro <pm...@columbia.edu>.
Ben is right.  Currently, values are bound only if translation succeeds 
(this is essential), but before validation happens.
This was done purposefully to support "Save" style logic, since 
validation errors can optionally be ignored in the triggered form 
listener by ignoring the value of IValidationDelegate.getHasErrors().
I put this logic in place before the veto logic was implemented (I think 
- although I work probably overlapped).  This is easy enough to change.
In 3.0, ValidField values could only be bound if and only if validation 
succeeded since the old IValidators were responsible for both 
translation and validation.
Since this limitation no longer exists, we have the option of binding 
value either before or after the validators run.

What are the advantages/disadvantages to each approach?

Paul

Howard Lewis Ship wrote:

>Validation does not work that way, not to my knowledge.  Even with the
>new validation, the translator and validators all have veto power, by
>throwing ValidationException, before an update occurs to the bound
>property.
>
>TAPESTRY-369 was a suggestion that was since judged invalid. It is not
>how Tapestry operates.
>
>On 8/23/05, Ben Pryor <BP...@widen.com> wrote:
>  
>
>>Hi,
>>
>> I'm upgrading a large Tapestry 3 application to Tapestry 4.  One
>>unexpected behavior is that the new validation system appears to always
>>update a form component's bound property before doing validation and
>>recording any errors. There is a JIRA issue from July that mentions this
>>behavior (http://issues.apache.org/jira/browse/TAPESTRY-369). The
>>problem is that almost everywhere in our application     we expect the
>>bound property to only be updated if validation succeeds.
>>
>>How do others handle this situation with the new validation? Should the
>>validation system be flexible enough to allow for sometimes updating the
>>bound property when in error and sometimes not?
>>
>>Thanks,
>> Ben
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Validatable fields: should bound property be updated if in error?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Validation does not work that way, not to my knowledge.  Even with the
new validation, the translator and validators all have veto power, by
throwing ValidationException, before an update occurs to the bound
property.

TAPESTRY-369 was a suggestion that was since judged invalid. It is not
how Tapestry operates.

On 8/23/05, Ben Pryor <BP...@widen.com> wrote:
> Hi,
> 
>  I'm upgrading a large Tapestry 3 application to Tapestry 4.  One
> unexpected behavior is that the new validation system appears to always
> update a form component's bound property before doing validation and
> recording any errors. There is a JIRA issue from July that mentions this
> behavior (http://issues.apache.org/jira/browse/TAPESTRY-369). The
> problem is that almost everywhere in our application     we expect the
> bound property to only be updated if validation succeeds.
> 
> How do others handle this situation with the new validation? Should the
> validation system be flexible enough to allow for sometimes updating the
> bound property when in error and sometimes not?
> 
> Thanks,
>  Ben
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org