Front page | perl.wxperl.users |
Postings from February 2013
Re: Vaiidators
Thread Previous
|
Thread Next
From:
James Lynes
Date:
February 13, 2013 16:18
Subject:
Re: Vaiidators
Message ID:
CABPysehZiBi-fKmM2OkSrRp0JdtwN_kVwSLEjz0_ox2MTBkZNQ@mail.gmail.com
Johan:
Thanks for the hint. I will give it a try.
Are validators not used very often? If multiple values need to be returned
from a custom dialog, is a hash reference used to return the values or do
you use multiple validators?
Maybe someone has a complete custom dialog they can post.
James
On Wed, Feb 13, 2013 at 2:43 AM, Johan Vromans <jvromans@squirrel.nl> wrote:
> James Lynes <jmlynesjr@gmail.com> writes:
>
> > print Dumper($timeval) says:
> > $VAR1 = bless( {
> > 'data' => \'10:00',
> > 'validate' => qr/(?^:(\d+:))/
> > }, 'LCDAlarmClockDialog::Validator' );
> >
> > 1. Not sure what the pre-pended ?^: means. It was added by
> > Wx::Perl::TextValidator
> >
> > 2. I have tried a number of regex strings:
> > (\d+) allows entry of numbers
> > (:) allows entry of colons
> > (\d+:) allows no entry at all
> > (\d+:\d+) allows no entry at all
> > (\d{2,}:\d{2,}) allows no entry at all
> >
>
> It's a long time ago that I playes with Validators, but I seem to recall
> that there was something with the moment the test was applied.
> The validator is really a filter, so it restrics what characters can be
> input. When you try (\d+:) then youy're matching more than one character
> against the input, which will always fail since the input initially is
> empty and the first character will never match the pattern.
>
> So the validator pattern should be sort of character class, e.g. [\d:]
> and you need an additional end-form validator ^(\d{2,}:\d{2,})$ in
> TransferFromWindow.
>
> -- Johan
>
Thread Previous
|
Thread Next