in reply to Re: Stopping bad input (harder than sanitizing)
in thread Stopping bad input (harder than sanitizing)
I think I made some progress:
$search = $top->Entry ('-width' => 20, '-validate' => 'key', '-validatecommand' => sub {$_[1] =~/\w+/ +;} , '-invalidcommand' => sub {$top -> bell() + ;}, ) ->pack('-side' => 'left');
I found the code on 'Mastering Perl/Tk' -- I modified it to work with my program. But I still need it to accept ':' and '-'. As for invalid input it should do something like this:
But it sill locks up...'-invalidcommand' => sub {$_[1] =~/^[[:cntrl:]] ; $top -> bell; }
2021-03-09 Athanasius added code tags around final snippet.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Stopping bad input (harder than sanitizing)
by swl (Prior) on Mar 09, 2021 at 06:44 UTC | |
by Anonymous Monk on Mar 10, 2021 at 18:11 UTC | |
by hippo (Archbishop) on Mar 10, 2021 at 18:48 UTC | |
by tybalt89 (Monsignor) on Mar 10, 2021 at 19:08 UTC | |
by Anonymous Monk on Mar 10, 2021 at 17:42 UTC |