That's a fantastic idea, I'll definitely do that.
There is one problem, because the validation is actualy coming from the
domain objects "setters", I don't know if there was a problem until the
"updateModel" method is called... I don't know if I like calling
"updateModel" from the validator, since I'm not sure whether that will break
other things down the road, I'll try it and report back.
Is there a way that I can retrieve the setter, so that I can set it, and
then return it to it's initial state before the form calls 'updateModel' on
it's children? Perhaps the component can only take PropertyModels?
Jeremy Thomerson-5 wrote:
>
> in the custom component's constructor, why don't you do:
>
> add(new IValidator() {
> ...
> });
>
> Or create a custom validator class and just add it to your custom
> components.
>
> On Tue, Feb 17, 2009 at 10:04 AM, walnutmon
> <[email protected]>wrote:
>
>>
>> All,
>>
>> I have custom components which know if they have a validation error when
>> they call "updateModel()", the domain is where validation happens, I'm
>> using
>> this to post error messages which are rendered like a validation error:
>>
>> @Override
>> public void updateModel()
>> {
>> try
>> {
>> super.updateModel();
>> } catch (Exception ex)
>> {
>> error(ex.getCause().getMessage());
>> }
>> }
>>
>> however, unlike a wicket validation error, it still finishes the form
>> submission, is there a way for a component to add a validation error, so
>> that it behaves as if it were a MaximumLengthValidator() error, or
>> something
>> similar? Or do I need to extend IValidator, and pass it the component's
>> domain object in order to do the check and use wicket's validation form
>> processing procedure.
>>
>> Thanks!
>> Justin
>> --
>> View this message in context:
>> http://www.nabble.com/Validation-From-A-Custom-Component-tp22060300p22060300.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]
>>
>>
>
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
--
View this message in context:
http://www.nabble.com/Validation-From-A-Custom-Component-tp22060300p22061961.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]