You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Florian Suschetz <fl...@jmh.one2space.com> on 2002/09/18 09:49:02 UTC

Get and Set INTAKE-Messages in Action-Class

Hi! I have following problem with intake:
in intake.xml I use:

...
<field name="yearFrom" key="yearFrom" type="int" mapToProperty="yearFrom">
              <rule name="maxLength" value="4">Not more tha 4 digits!</rule>
              <rule name="mask" value="^[0-9]*$">Only Numbers!</rule>
              <rule name="minValue" value="1900">Year at least 1900!</rule>

        </field>

        <field name="yearTo" key="yearTo" type="int" mapToProperty="yearTo">
              <rule name="maxLength" value="4">Not more tha 4 digits!</rule>
              <rule name="mask" value="^[0-9]*$">>Only Numbers!</rule>
              <rule name="minValue" value="1900">Year at least 1900!</rule>
        </field>
...

Well the rules work, and the validation of them in the vm too, but now I
want to do following:
I want to validate that the "yearFrom"-field is smaller than the
"yearTo"-field. I bet with intake
itself this is not possible. So I want to validate it in my action-class.
My two questions are:

1) How do I access intake in my action class?
When I use in the action class:

>> Group group = intake.get("groupName","");

and then
>> group.get("yearFrom").setMessage("Message: Year from must be smaller than
year to!");
or
>> group.get("yearFrom").getMessage();

I get the Error, that the intake-field was not found. (I'm quite sure that I
had not typed something wrong :)


2)When I get the
group.get("yearFrom").setMessage("Message"); directive working, I don't want
to set the message
hardcoded in the action, I want to specify the message in intake.xml.
To sum up: I want to validate a field in the action-class, but specify the
error message in intake.xml

I would be verry happy, if somebody could help me!

Cheers
Florian



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>