[
http://www.stripesframework.org/jira/browse/STS-687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Frederic Daoud closed STS-687.
------------------------------
Resolution: Not a Bug
I don't think the behavior of on= should be changed. The rationale is that
fields for which values have been submitted should *always* be validated.
Furthermore, non-required fields that are left blank are *not* validated. This
makes sense: non-required fields are optional by definition! Finally, you have
full control over which fields you include in the specific forms that submit to
specific event handlers. The on= attribute is to prevent validation errors for
required fields that are not part of certain forms or event handlers.
As for @StrictBinding, is it to prevent malicious users from binding to
properties that are *never* meant to be bound to from the outside. In your
example, both properties *are* meant to be bound to, just not in the same event
handlers. In that case it is up to you to perform proper validations and/or
just ignore the field that is irrelevant for each event handler.
I hope my explanations made sense; let me know if you need more clarification.
> @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
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development