You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pedro Santos <pe...@gmail.com> on 2010/04/19 21:27:49 UTC
Re: How to validate an entire object in a form (rather than a
particular property of that object)
Hi Dan
On Mon, Apr 19, 2010 at 2:04 PM, Dan Haywood <dk...@gmail.com> wrote:
> Another form-related question.
>
> I can see how to install a validator on a Form - Form#add(IFormValidator) -
> but it seems that AbstractFormValidator, the adapter, always requires a
> specific FormComponent to be specified in its error(...) method.
>
> How does one raise an error on the state of the form (and by implication,
> that of the underlying domain object) itself, without having to specify any
> form component?
>
>
FeedbackMessages API, is expection an Component object as reporter. Maybe
add the validation error to the form component will make sense:
formComponent.getForm().error( theValidationErrorNotFormComponentSpecific )
An example would be the classic fromDate < endDate. A workaround would be
> to install the validator on - say - the endDate. But I'm after a general
> solution, rather than a solution for this particular example.
>
> Thanks
> Dan
>
>
> --
> Dan Haywood consultant, mentor, developer, author agile, ddd, oo,
> java, .net, sybase MA, MBCS, CITP, CEng *mail: *
> dan@haywood-associates.co.uk *phone: *+44 (0)7961 144286 *book: *Domain
> Driven Design using Naked Objects <http://pragprog.com/titles/dhnako> *blog:
> *http://danhaywood.com *linked in: *http://uk.linkedin.com/in/dkhaywood
> *twitter: *http://twitter.com/dkhaywood *sybase: *
> http://sybtraining.co.uk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Pedro Henrique Oliveira dos Santos
Re: How to validate an entire object in a form (rather than a particular
property of that object)
Posted by Dan Haywood <dk...@gmail.com>.
ok, thanks ... that worked. It threw up a different problem, but
that'll be another post.
Dan
On 20/04/2010 01:53, Igor Vaynberg wrote:
> you can override form.onvalidate() and do your validation there
>
> -igor
>
> On Mon, Apr 19, 2010 at 4:51 PM, Dan Haywood <dkhaywood@gmail.com
> <ma...@gmail.com>> wrote:
>
> Hi Pedro,
> but my problem is that there is no form component to represent the
> form itself, is there?
>
> Any other thoughts?
>
> Dan
>
>
>
> On 19/04/2010 20:27, Pedro Santos wrote:
>> Hi Dan
>>
>> On Mon, Apr 19, 2010 at 2:04 PM, Dan Haywood <dkhaywood@gmail.com
>> <ma...@gmail.com>> wrote:
>>
>> Another form-related question.
>>
>> I can see how to install a validator on a Form -
>> Form#add(IFormValidator) - but it seems that
>> AbstractFormValidator, the adapter, always requires a
>> specific FormComponent to be specified in its error(...) method.
>>
>> How does one raise an error on the state of the form (and by
>> implication, that of the underlying domain object) itself,
>> without having to specify any form component?
>>
>>
>> FeedbackMessages API, is expection an Component object as
>> reporter. Maybe add the validation error to the form component
>> will make sense:
>>
>> formComponent.getForm().error(
>> theValidationErrorNotFormComponentSpecific )
>>
>> An example would be the classic fromDate < endDate. A
>> workaround would be to install the validator on - say - the
>> endDate. But I'm after a general solution, rather than a
>> solution for this particular example.
>>
>> Thanks
>> Dan
>>
>>
>> --
>> Dan Haywood
>> consultant, mentor, developer, author
>> agile, ddd, oo, java, .net, sybase
>> MA, MBCS, CITP, CEng
>> /mail: /dan@haywood-associates.co.uk
>> <ma...@haywood-associates.co.uk>
>> /phone: /+44 (0)7961 144286
>> /book: /Domain Driven Design using Naked Objects
>> <http://pragprog.com/titles/dhnako>
>> /blog: /http://danhaywood.com
>> /linked in: /http://uk.linkedin.com/in/dkhaywood
>> /twitter: /http://twitter.com/dkhaywood
>> /sybase: /http://sybtraining.co.uk
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> <ma...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>> <ma...@wicket.apache.org>
>>
>>
>>
>>
>> --
>> Pedro Henrique Oliveira dos Santos
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> <ma...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
> <ma...@wicket.apache.org>
>
>
Re: How to validate an entire object in a form (rather than a
particular property of that object)
Posted by Igor Vaynberg <ig...@gmail.com>.
you can override form.onvalidate() and do your validation there
-igor
On Mon, Apr 19, 2010 at 4:51 PM, Dan Haywood <dk...@gmail.com> wrote:
> Hi Pedro,
> but my problem is that there is no form component to represent the form
> itself, is there?
>
> Any other thoughts?
>
> Dan
>
>
>
> On 19/04/2010 20:27, Pedro Santos wrote:
>
> Hi Dan
>
> On Mon, Apr 19, 2010 at 2:04 PM, Dan Haywood <dk...@gmail.com> wrote:
>
>> Another form-related question.
>>
>> I can see how to install a validator on a Form - Form#add(IFormValidator)
>> - but it seems that AbstractFormValidator, the adapter, always requires a
>> specific FormComponent to be specified in its error(...) method.
>>
>> How does one raise an error on the state of the form (and by implication,
>> that of the underlying domain object) itself, without having to specify any
>> form component?
>>
>>
> FeedbackMessages API, is expection an Component object as reporter. Maybe
> add the validation error to the form component will make sense:
>
> formComponent.getForm().error( theValidationErrorNotFormComponentSpecific )
>
> An example would be the classic fromDate < endDate. A workaround would
>> be to install the validator on - say - the endDate. But I'm after a general
>> solution, rather than a solution for this particular example.
>>
>> Thanks
>> Dan
>>
>>
>> --
>> Dan Haywood consultant, mentor, developer, author agile, ddd, oo,
>> java, .net, sybase MA, MBCS, CITP, CEng *mail: *
>> dan@haywood-associates.co.uk *phone: *+44 (0)7961 144286 *book: *Domain
>> Driven Design using Naked Objects <http://pragprog.com/titles/dhnako> *blog:
>> *http://danhaywood.com *linked in: *http://uk.linkedin.com/in/dkhaywood
>> *twitter: *http://twitter.com/dkhaywood *sybase: *
>> http://sybtraining.co.uk
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
Re: How to validate an entire object in a form (rather than a particular
property of that object)
Posted by Dan Haywood <dk...@gmail.com>.
Hi Pedro,
but my problem is that there is no form component to represent the form
itself, is there?
Any other thoughts?
Dan
On 19/04/2010 20:27, Pedro Santos wrote:
> Hi Dan
>
> On Mon, Apr 19, 2010 at 2:04 PM, Dan Haywood <dkhaywood@gmail.com
> <ma...@gmail.com>> wrote:
>
> Another form-related question.
>
> I can see how to install a validator on a Form -
> Form#add(IFormValidator) - but it seems that
> AbstractFormValidator, the adapter, always requires a specific
> FormComponent to be specified in its error(...) method.
>
> How does one raise an error on the state of the form (and by
> implication, that of the underlying domain object) itself, without
> having to specify any form component?
>
>
> FeedbackMessages API, is expection an Component object as reporter.
> Maybe add the validation error to the form component will make sense:
>
> formComponent.getForm().error(
> theValidationErrorNotFormComponentSpecific )
>
> An example would be the classic fromDate < endDate. A workaround
> would be to install the validator on - say - the endDate. But I'm
> after a general solution, rather than a solution for this
> particular example.
>
> Thanks
> Dan
>
>
> --
> Dan Haywood
> consultant, mentor, developer, author
> agile, ddd, oo, java, .net, sybase
> MA, MBCS, CITP, CEng
> /mail: /dan@haywood-associates.co.uk
> <ma...@haywood-associates.co.uk>
> /phone: /+44 (0)7961 144286
> /book: /Domain Driven Design using Naked Objects
> <http://pragprog.com/titles/dhnako>
> /blog: /http://danhaywood.com
> /linked in: /http://uk.linkedin.com/in/dkhaywood
> /twitter: /http://twitter.com/dkhaywood
> /sybase: /http://sybtraining.co.uk
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> <ma...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
> <ma...@wicket.apache.org>
>
>
>
>
> --
> Pedro Henrique Oliveira dos Santos