You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl-cvs@perl.apache.org by ri...@apache.org on 2004/01/02 16:24:08 UTC
cvs commit: embperl/Embperl/Form Validate.pm
richter 2004/01/02 07:24:08
Modified: . Changes.pod TODO
Embperl/Form Validate.pm
Log:
-break parameter for Embperl::Form::Validate
Revision Changes Path
1.216 +2 -0 embperl/Changes.pod
Index: Changes.pod
===================================================================
RCS file: /home/cvs/embperl/Changes.pod,v
retrieving revision 1.215
retrieving revision 1.216
diff -u -r1.215 -r1.216
--- Changes.pod 28 Nov 2003 06:58:52 -0000 1.215
+++ Changes.pod 2 Jan 2004 15:24:08 -0000 1.216
@@ -4,6 +4,8 @@
This version is currently under developement. You can get it from the L<CVS|CVS.pod>.
+ - Added -break parameter for haveing precondition to
+ Embperl::Form::Validate
- fixed various compiler warnings reported by Angus Lees.
- Added missing Form/Validate modules to distribution.
- fixed missing $req_rec in base template call from Embperl::Object.
1.112 +2 -0 embperl/TODO
Index: TODO
===================================================================
RCS file: /home/cvs/embperl/TODO,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- TODO 28 Nov 2003 06:58:52 -0000 1.111
+++ TODO 2 Jan 2004 15:24:08 -0000 1.112
@@ -7,5 +7,7 @@
- include at top of every file [Kee Hinckley 3.8.2003]
+- debug defualt to zero?
+
TODO for Embperl 2.1 and later
1.7 +27 -9 embperl/Embperl/Form/Validate.pm
Index: Validate.pm
===================================================================
RCS file: /home/cvs/embperl/Embperl/Form/Validate.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Validate.pm 11 Apr 2003 05:58:35 -0000 1.6
+++ Validate.pm 2 Jan 2004 15:24:08 -0000 1.7
@@ -256,6 +256,7 @@
my $status ;
my $name ;
my $msg ;
+ my $break = 0 ;
while ($i < @$frules)
{
@@ -285,14 +286,18 @@
$name = undef ;
$msg = undef ;
}
- if ($1 eq 'name')
+ elsif ($1 eq 'name')
{
$name = $i++ ;
}
- if ($1 eq 'msg')
+ elsif ($1 eq 'msg')
{
$msg = $i++ ;
}
+ elsif ($1 eq 'break')
+ {
+ $break = $frules->[$i++] ;
+ }
elsif ($1 eq 'type')
{
$type = $frules->[$i++] ;
@@ -321,7 +326,7 @@
if ($status)
{
- if (@$status)
+ if (@$status && !$break)
{
my $id = $status -> [0] ;
push @$result, { typeobj => $typeobj, id => $id, key => $key, ($name?(name => $frules -> [$name]):()), ($msg?(msg => $frules -> [$msg]):()), param => $status} ;
@@ -474,6 +479,7 @@
my $scriptcode = $self -> {scriptcode} ||= {} ;
my $script = '' ;
my $form = $self -> {form_id} ;
+ my $break = 0 ;
while ($i < @$frules)
{
@@ -499,14 +505,18 @@
$name = undef ;
$msg = undef ;
}
- if ($1 eq 'name')
+ elsif ($1 eq 'name')
{
$name = $i++ ;
}
- if ($1 eq 'msg')
+ elsif ($1 eq 'msg')
{
$msg = $i++ ;
}
+ elsif ($1 eq 'break')
+ {
+ $break = $frules->[$i++] ;
+ }
elsif ($1 eq 'type')
{
$type = $frules->[$i++] ;
@@ -557,7 +567,7 @@
my $nametxt = $name?$frules -> [$name]:undef ;
my $msgtxt = $msg?$frules -> [$msg]:undef ;
my $setmsg = '' ;
- if ($msgparam)
+ if ($msgparam && !$break)
{
my $txt = $self -> build_message ($msgparam -> [0], $key, $nametxt, $msgtxt, $msgparam, $typeobj, $pref, $epreq) ;
$setmsg = "msgs[i++]='$txt';"
@@ -793,11 +803,19 @@
=item -fail
-stops further validation after the first error is found
+stops further validation of any rule after the first error is found
=item -cont
continues validation in the same group, also a error was found
+
+=item -break => 1
+
+errors only break current block, but does not display any message
+
+=item -break => 0
+
+turns on normal behaviour
=item [arrayref]
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-cvs-help@perl.apache.org