Hi Ned,

Here my 2 cents,

If you look at the Form.process method you'll see that only after
validating the model object is updated. There is no hook that you can
use to get a callback after the model object is updated. The only way
I see is to override the process method itself (which is not
recommended btw).

I think it might be a better solution to create a IFormValidator and
call your SpringValidator from there. Then you can pass in the Form
object itself into the Spring Validators and validate that instead of
your Model objects.
Also: When you allow invalid values in your Model you are basically
putting you model classes in an illegal state which (depending on your
code of course) can lead to strange behavior. In general it is good
practice to only allow objects to be in a valid state, which of course
depends on your definition of valid state :-).

Lars

On Wed, Jul 16, 2008 at 9:12 AM, Ned Collyer <[EMAIL PROTECTED]> wrote:
>
> I've written some code that allow spring to validate objects for me using the
> org.springframework.validation.Validator interface.
>
> I've also got some code that maps the ValidationErrors back to wicket
> fields.
>
> The spring validators take an entire object rather than field by field.   My
> question is, during the validation phase, how should I invoke this
> validator?
>
> Basically I need the modelObject of the form to be updated (if possible)
> with submitted values before I call the Spring validator.
>
> How should I go about doing this?
>
> I can see a todo in the javadoc for IFormValidator -  "make IFormValidator
> extends IValidator where IValidatable's value is form.modelobject and error
> reports on form - that way IBehaviorProvider can extend IValidator"
>
> However currently the form.getModelObject is returning the non updated (from
> submit) object.
>
> Please help :)
> --
> View this message in context: 
> http://www.nabble.com/IFormValidator---I-need-some-clarification-please-tp18481522p18481522.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to