Hi!
You wrote that I should use
Group group = intake.get("groupName", IntakeTool.DEFAULT_KEY);
to retieve the group. I tried i out, but it does not work!
The validation only works with:
Group group = intake.get("groupName", "");
Here is an extract of the used vm:
#if($intakeGroup.yearFrom.Message)
#ErrorMessage($intakeGroup.yearFrom.Message)
#end
#if($intakeGroup.yearTo.Message)
#ErrorMessage($intakeGroup.yearTo.Message)
#end
<TR>
#formLabel($l_year)
<TD></TD>
#yearFromToField("$intakeGroup.yearFrom.Key"
"$intakeGroup.yearTo.Key")
</TR>
when I use your directive to retieve the intakeGroup in the ActionClass, I
get no error,
but no intake message are displayed, allthough there should be one
----- Original Message -----
From: "Akmal Sarhan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 18, 2002 10:42 AM
Subject: Re: Get and Set INTAKE-Messages in Action-Class
> you should supply more detail about the problem, like how does your
template
> look like?
>
> but from what I could see you should retrieve the group like that:
> IntakeTool intake = (IntakeTool) context.get("intake");
> Group group = intake.get("groupName", IntakeTool.DEFAULT_KEY);
>
> and then I hope it will work
> regards
> Akmal
>
> ........................................................
> Akmal Sarhan
>
> Freelance Software-Entwickler
> Berlin
> Deutschland
> ........................................................
>
>
>
> >From: "Florian Suschetz" <[EMAIL PROTECTED]>
> >Reply-To: "Turbine Users List" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Subject: Get and Set INTAKE-Messages in Action-Class
> >Date: Wed, 18 Sep 2002 09:49:02 +0200
> >
> >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:
> ><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
>
>
>
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>