[ http://mc4j.org/jira/browse/STS-303?page=comments#action_10686 ]
Karel Kolman commented on STS-303:
----------------------------------
I'd love to be able to set min and max number of elements allowed in an indexed
property.
Using the example from the documentation:
@ValidateNestedProperties(
@Validate(field="phoneNumber", required=true),
@Validate(field="pets", minsize=0, maxsize=10),
@Validate(field="pets.age", required=true, maxvalue=100),
@Validate(field="pets.nicknames.name", required=true, maxlength=50)
)
private Person person;
The pets collection has minsize set to 0 - the last two validation rules are
skipped when a form with no pets specified is submitted.
If minsize was set to 1, at least one pet would have to be assigned to a person.
> Nested validation errors reported when validating a null or zero length map.
> ----------------------------------------------------------------------------
>
> Key: STS-303
> URL: http://mc4j.org/jira/browse/STS-303
> Project: Stripes
> Issue Type: Bug
> Components: Validation
> Affects Versions: Release 1.4.1
> Environment: Windows / Tomcat 5.5
> Reporter: Simon Engledew
> Assigned To: Tim Fennell
>
> I've been working on a javascript-enabled form that allows you to dynamically
> add and remove 'rows' in a table, represented by TreeMaps of beans
> stripes-side:
> public TreeMap<Long, ChannelDataBean> getChannels() { return this.channels; }
> public void setChannels(TreeMap<Long, ChannelDataBean> channels) {
> this.channels = channels; }
> @ValidateNestedProperties
> ({
> @Validate(field="name", required=true, minlength=3, maxlength=50),
> @Validate(field="incomingUsername", required=true, minlength=3,
> maxlength=50),
> @Validate(field="outgoingUsername", required=true, minlength=3,
> maxlength=50),
> @Validate(field="incomingPassword", required=true, minlength=3,
> maxlength=50),
> @Validate(field="outgoingPassword", required=true, minlength=3,
> maxlength=50)
> })
> private TreeMap<Long, ChannelDataBean> channels;
> and their appropriate inputs, generated by reflection, page side.
> It works great -- unless you try and submit a form with no elements at all.
> In this case, Stripes reports validation errors for every single bean
> property described in the corresponding nested @Validate annotation.
> Is there a work-around for this, aside from implementing a
> ValidationErrorHandler (I kind of want the solution to be totally portable
> and generic, which it is currently), or is this a bug.
> Cheers
> Si
> PS: I love stripes, it's seriously excellent. Cheers for the terrific
> framework.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development