On Sat, 23 Mar 2002, John McNally wrote: > Edmund Urbani wrote: > > > > Hi! > > > > I have got a problem with the rules for checking field values in intake. > > Somehow I cannot check for empty fields. I define the rule as explained in the > > docs like this: > > > > .. > > <field name="PersonName" key="personname" type="String"> > > <rule name="minLength" value="1">Bitte geben Sie den Nachnamen an.</rule> > > </field> > > .. > > > > When I leave the field empty, intake does not report an error. > > (isAllValid() still returns true) > > not sure why this does not work. > > > I have experimented a bit with intake, and other rules actually do work as > > expected, if the field value is not empty. It seems the rules simply > > bypassed for empty fields and no checks are applied. So I also tried > > setting the required messsage: > > > > .. > > <field name="PersonName" key="personname" type="String"> > > <required-message>Bitte geben Sie den Nachnamen an.</required-message> > > </field> > > .. > > > > Again, no error when I leave the field empty. Is this a bug in the intake > > service (included in TDK 2.1 release) or am I doing something wrong? > > > <required-message> is to provide a message that is to be displayed if > the field is declared as required and the field is empty. It does not > make the field required. > > <rule name="required" value="true">Bitte geben Sie den Nachnamen > an.</rule> > > should work, though i have not looked at what's in 2.1 for a while. > > john mcnally >
Thanks for the quick reply. That rule actually does seem to work (though I cannot find anything about a rule with name "required" in the intake docs at http://jakarta.apache.org/turbine/turbine-2/services/intake-service.html). A bit odd is, that the isAllValid() method still returns true, but lateron when I try to assign the fields to the proper data object (using the group.setProperties() method) an exception is thrown (message: "Attempted to assign an invalid input"). Maybe I can figure out another way to check the field validity (either that, or I will have to watch for that exception). Edmund Urbani -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
