Thanks a lot Quinton for your suggestion. Could you give me some more advise
please as neither the intake-howto nor the intake-service doc refer to the
validator-attribute.

> You could write a custom validator that would allow rules to be added
> dynamically.  Specify this in your intake group.

So I just add the validator-attribute to the field-element like this

<group key="kundendaten" name="KundendatenGroup" mapToObject="om.Kunde">
...
        <field name="Ort" key="f" type="String" mapToObject="om.Kunde"
mapToProperty="Ort" validator="ortval"/>

and don't add any rule-element, right?

> In order to access the validator, you must have access to the field
> objects.  You do this by using the intake tool to get the group which,
> in turn, can give you the fields.  Once you have the field,
> field.getValidator() will give you your custom validator that you
> specified in intake.xml.

I can follow you so far:
(in action-method)
    IntakeTool intake = (IntakeTool)context.get("intake");
    Group group = intake.get("KundendatenGroup","kundendaten");
    Field ort = group.get("Ort");
    Validator val = ort.getValidator();

Now what do I do with the validator to validate the field?
And where do I put the code for the actual validation?

Greetings

Marc

> After you have added the dynamic rules to the appropriate fields, just
> call group.isAllValid() as before.



>
> > -----Original Message-----
> > From: Marc Lustig [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 15, 2003 8:40 AM
> > To: Turbine Users List
> > Subject: Intake question: how to add custum rule functions ?
> >
> >
> > Hi,
> >
> > I need to do some validation on submitted form-fields that
> > are not supported by any of the rule-elements. (E.g. I need
> > to look up the value in a different table.)
> >
> > Has anybody successfully added custom rule-functions manually
> > in the action-method, before calling intake.isAllValid() ?
> >
> > Actually, my idea is to extend TurbineIntakeService and add
> > methods to validate form-fields individually. First problem
> > is I can't see any methods in TurbineIntakeService to get the
> > form-fields and to mark fields as un/validated (like
> > setFieldAsValidated(String fieldname)).
> >
> > Any Intake-expert out there who can give me a hint?
> >
> > Marc
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:turbine-user-> [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]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to