@Validate and @StrictBinding should use the on-parameter
--------------------------------------------------------

                 Key: STS-687
                 URL: http://www.stripesframework.org/jira/browse/STS-687
             Project: Stripes
          Issue Type: New Feature
          Components: Validation
    Affects Versions: Release 1.5.1
            Reporter: Joakim Kemeny


The @Validate-annotation has the on-property which restricts the set of events 
to which the required check is applied. This is great but it should not be 
limited to the required check, it should apply to other checks as well. 

I know that this issue has been rejected as "Not a Bug" in STS-545 and it's 
true that it's not a bug but it would be a very useful feature and it would 
make the use of the on-property more consistent and logical.

In the answer to STS-545 Tim writes that it makes it possible to make a field 
required on certain events and optional on others and still ensure that it is 
valid when submitted. I understand this but this could apply to other checks as 
well. Why not have a global on-property and specialized properties for each 
check, like this.

@Validate(required = true, minvalue =0, maxvalue = 100, on = "save", 
requiredOn="!list")

Another use for this is @StrictBinding. @StrictBinding uses the @Validate 
-annotation to check whether a property should bind or not. Unfortunately it 
doesn't care about the on-property and this prevents us from using it in cases 
like the example below.

@StrictBinding
public TimerAction implements ActionBean {

    @ValidateNestedProperties({
        @Validate(field = "startDate", on = "start"),
        @Validate(field = "endDate", on "end")})
    private Timer timer;

    public Resolution start() {..}
    public Resolution end() {..}

    ....
}

In this case startDate should only bind to timer.startDate on start and endDate 
on end. To do this now we have to create separate classes.

The request is to make the use of the on-property more consistent and useable 
for all parts that use the @Validate-annotation.

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

        

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to