Yeah you need to validate the input first before passing it through Converter.

Check if you need a custom validator in the first place. There are
quite a few that ships with Wicket. I had to validate the phone number
that i was accepting as an input and i used
wicket.markup.html.form.validation.PatternValidator for that.

All FormComponent-s accept a validator through add(IValidator v)
method.All html components inherit from it.

If you want to write your own , you can extend
wicket.markup.html.form.validation.StringValidator and provide
implementation for abstract onValidate(FormComponent formComponent,
String value) method and attach it to the html form component. Wicket
will call the validator during form submit.

regs,
karthik


On 1/15/06, David Leangen <[EMAIL PROTECTED]> wrote:
>
> I'm using IConverter as explained on the following wiki page:
>
>  http://www.wicket-wiki.org.uk/wiki/index.php/Using_custom_converters
>
>
> It is a very elegant way of translating between a domain object and its
> representation on a web page. Very nice!
>
>
> How can I attach my own custom validator? Right now, I am getting a stack
> trace, which is thrown when my custom converter does not like the input.
>
>
> Thanks!
> Dave
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to