You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Kastner <ka...@galt.de> on 2004/04/28 12:25:47 UTC
ValidatorForm map values problem
Hello,
this problem has been bugging me for days now. Maybe somebody can help
me with this.
I've created a class named InvoiceEditForm extending ValidatorForm. It
contains a couple of fields amongs which are two fields which need to be
validated on proper user input.
One is an integer the other one is a simple string. Sounds like a piece
of cake, right?
So, I can enter the values, they are properly validated, but then ...
... when I try to get the values with getResultValueMap() only the
userId value is available. When I iterate throug the map's keys then
invoiceNr is simply not there.
However, when I replace "mask" in the "required" attribute with integer
for the invoiceNr property, then suddenly (tada !!!!) invoiceNr is
available via the proper key and as an integer.
But that's not what I want. I don't want to invoiceNr as an integer but
as a String.
Furthermore, I also have field named "amount". This is being validated
against the local currency format. This is being done in the overriding
the validate method. The validate value is put into the resultValueMap
by using getResultValueMap(). But even though key an value are being put
into the map, they don't appear when I call them in my Action.
Maybe someone has clue. Below the form section of my validation.xml is
listed.
Thanks to anyone reading this.
Michael Kastner
Form section in my validation file looks like this:
<form name="invoiceEditForm">
<field
property="userId"
depends="required,integer">
<msg
name="required"
key="invoiceeditform.error.userid.required"/>
<msg
name="integer"
key="invoiceeditform.error.userid.required"/>
</field>
<field
property="invoiceNr"
depends="required,mask">
<msg
name="required"
key="invoiceeditform.error.invoicenr.required"/>
<msg
name="mask"
key="invoiceeditform.error.invoicenr.required"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
</form>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org