This is with reverence to Indexed Properties as defined on
http://www.stripesframework.org/display/stripes/Indexed+Properties
I have a form that has two rows of data, each row consisting of a
question and answer. However each row is mandatory, so the normal use
of indexed properties doesn't work, as it only validates non-empty rows:
@ValidateNestedProperties({
:
@Validate(field="securityQuestions.question", on="save",
required=true),
@Validate(field="securityQuestions.answer", on="save",
required=true),
:
})
However if I explicitly index the properties like this:
@ValidateNestedProperties({
:
@Validate(field="securityQuestions[0].question", on="save",
required=true),
@Validate(field="securityQuestions[0].answer", on="save",
required=true),
@Validate(field="securityQuestions[1].question", on="save",
required=true),
@Validate(field="securityQuestions[1].answer", on="save",
required=true),
:
})
Then it *does* actually check that the fields are non-empty, even though
the Stripes documentation suggests this shouldn't work. There's just
one nit: the very first time the form is submitted, I get a warning:
Invalid property name: securityQuestions[0]
and then nothing subsequently, no matter how many times it is submitted
- most odd. This very nearly works as I expect and is generally useful,
for example lists where the first few items are mandatory. Any chance
it could be properly supported in the next release?
--
Alan Burlison
--
------------------------------------------------------------------------------
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 asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users