develooper Front page | perl.wxperl.users | Postings from February 2013

Vaiidators

Thread Next
From:
James Lynes
Date:
February 11, 2013 00:16
Subject:
Vaiidators
Message ID:
CABPysej2Wp9tAkaObqykdsyi9WORfu9A8bsfh5gtpgU-NuX1Wg@mail.gmail.com
Hi:

I am playing with creating a custom dialog using validators and I seem to
have hit a wall. I am using the code from the wxPerl demo program.

My setup is:
    my $timeval = LCDAlarmClockDialog::Validator->new( qr/(\d+)/,
\($self->{data}) );

    I want to enter a time of day value such as ##:## and ensure the colon
was entered.

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

    Do validators not allow for mixed alphanumeric fields? Seems like a
common need.
    If they do, how do you structure it?

Thanks, James

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About