> -----Original Message----- > From: Marc Lustig [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 15, 2003 5:47 PM > To: Turbine Users List > Subject: AW: Intake question: how to add custum rule functions ? > > > A few more questions: > > What does the attribute validator="val" refer to? The name of > the Validator-class including package?
It is the fully qualified class name of the Validator class to be used. > > void doAssertValidity(String value) throws ValidationException: > - "value" is the content of the submitted form-field, right? Yes. > - if the validation fails I need to throw a new ValidationException? Yes. > - how would you suggest to store the PK that I retrieve in > this method and that I need later to store in the BO? user.Temp? I suppose this would work fine. You could also add a method to your validator that return the PK value. > > Do I need one Validator class for each of the fields where > custom validation is needed, or can I use one class for > multiple validations? (I suspect I need one class for every > single kind of validation.) It depends on how you write the Validator. You can still use the rule tag to pass In some information. Specifically, the rule name and a value. Perhaps the String in the value could be parsed out to get enough information to perform the lookup. If so, you only need one. > > Last but not least: how do I specifiy the error-message that > should be displayed if validation for this field fails? > Usually this is stated like > this: > <rule>Error-Message</rule>, but if I don't use the > rule-element where do I put the message ... > I would still use the rule tag. Even if you do not use it to configure the the specifics of the lookup, you can still use it to pass in the error message. If not, you will have to hard code the error message in the validator. > > Marc > If you can write a single validator that is configurable, it would make a very nice addition to the intake service.... ;-) If not, it is a great candidate for a how-to. > > > -----Ursprungliche Nachricht----- > > Von: Quinton McCombs [mailto:[EMAIL PROTECTED]] > > Gesendet: Donnerstag, 16. Januar 2003 00:06 > > An: Turbine Users List > > Betreff: RE: Intake question: how to add custum rule functions ? > > > > > > Okay. All that you need to do is create a new Validator inheriting > > from DefaultValidator that will do what you want. You > validation code > > will go in doAssertValidity(). > > > > If the call to group.isAllValid() works, then just get the > object and > > map to to the group. You will not have to get the field and the > > validator objects. > > > > I know of no problems with Intake redisplaying the data. > If you run > > into this, please let me know. > > > > > -----Original Message----- > > > From: Marc Lustig [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, January 15, 2003 4:57 PM > > > To: Turbine Users List > > > Subject: AW: Intake question: how to add custum rule functions ? > > > > > > > > > > Out of curiousity, what sort of rules are you wanting to add > > > > dynamically? > > > > > > For now what I need is to look up in another table if the data > > > entered into the field exists or not. If it exists, I > need the PK of > > > that corresponding row to set in the object/property that > is mapped > > > to the field. (I suspect that will not work using > > > group.setProperties(myBO), but I guess I can set it explicitly > > > afterwards.) > > > > > > If the field doesn't exist, the validation should fail > and the page > > > redisplayed with all the values that were previously > entered. Btw, > > > is that working with current Intake? I read on the list > that Intakte > > > won't redisplay the data properly. > > > > > > Not quite sure what you mean with "dynamically". I need the same > > > rule everytime I validate using this Group. Not sure what > is dynamic > > > about that... > > > > > > > > > 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: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]>
