Hi, I am looking for the right syntax to write validations for fields in
iterator.
<s:iterator value="mother.child" status="status">
<s:textfield name="mother.child[%{#status.index}].name"/>
<s:textfield name="mother.child[%{#status.index}].pocketmoney"
value="%{getFormatted('myDoubleFormat','pocketmoney')}" />
</s:iterator>
(value="%{getFormatted('myDoubleFormat','mother.child[%{#status.index}].pocketmoney')}"
caused an OGNL error)
I tried several xml field validators (requiredstring, stringlength, required,
double, conversion) starting with:
<field name="mother.child[].name"> or <field name="mother.child.name">
<field name="mother.child[].pocketmoney">
but I get fielderrors for field mother.child[].name (required even all childs
have names)
The required validators throw errors, the rest does nothing.
And a conversion error ('x' for pocketmoney) pops up but the field is not
populated with the bad value.
(getFormatted worked well in not-iterator-fields, but not here.)
<field-validator type="conversion">
<param name="repopulateField">true</param>
also does not repopulate.
Before I start writing all the validations on myself, I would like to know if
there is a better way.
(migrating from Struts1: <field property="pocketmoney"
indexedListProperty="child" depends="mask">; can not believe that there is no
equivalent in Struts7)
By the way, I am missing @DoubleRangeFieldValidator as @Repeatable (as there is
for Integer and Long).
I went into the wrong direction with the double validator, not understanding:
"maxInclusive - the maximum inclusive value in FloatValue format specified by
Java language (if none is specified, it will not be checked)."
For German locale , we have to write 9.999,99. No float, just so normal...
And I did not like it that I had to validate decimal places on my own (silent
rounding, no error when not matching my format)
Best regards Ute
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]