You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by ma...@axkit.org on 2003/08/10 19:42:57 UTC
CVS update: AxKit-XSP-PerForm
Date: Sunday August 10, 2003 @ 17:43
Author: matt
Update of /home/cvs/AxKit-XSP-PerForm
In directory ted.sergeant.org:/home/matt/Perl/AxKit-XSP-PerForm
Modified Files:
Changes PerForm.pm
Log Message:
Fix issue with no button being pressed.
Log:
PR:
Index: Changes
===================================================================
RCS file: /home/cvs/AxKit-XSP-PerForm/Changes,v
retrieving revision 1.10
retrieving revision 1.11
diff -b -u -r1.10 -r1.11
--- Changes 2003/06/24 10:17:29 1.10
+++ Changes 2003/08/10 16:43:56 1.11
@@ -1,5 +1,9 @@
Revision history for Perl extension AxKit::XSP::PerForm.
+1.8.3
+ - Added support for a default form submit routine, in case the
+ form was submitted without clicking a button.
+
1.8.2
- Add disabled, onclick and onchange attributes to each element
Index: PerForm.pm
===================================================================
RCS file: /home/cvs/AxKit-XSP-PerForm/PerForm.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -b -u -r1.23 -r1.24
--- PerForm.pm 2003/06/24 10:17:29 1.23
+++ PerForm.pm 2003/08/10 16:43:56 1.24
@@ -1,8 +1,8 @@
-# $Id: PerForm.pm,v 1.23 2003/06/24 10:17:29 matt Exp $
+# $Id: PerForm.pm,v 1.24 2003/08/10 16:43:56 matt Exp $
package AxKit::XSP::PerForm;
-$VERSION = "1.82";
+$VERSION = "1.83";
use AxKit 1.4;
use Apache;
@@ -134,7 +134,7 @@
\$redirect = \$sub->(\$_form_ctxt, \$_cancel_index{\$cancel}{'index'});
}
if (\$redirect) {
- AxKit::XSP::WebUtils::redirect(\$redirect,undef,undef,1);
+ return AxKit::XSP::WebUtils::redirect(\$redirect,undef,undef,1);
}
}
}
@@ -150,12 +150,23 @@
\$redirect = \$sub->(\$_form_ctxt, \$_submit_index{\$submit}{'index'});
}
if (\$redirect) {
- AxKit::XSP::WebUtils::redirect(\$redirect,undef,undef,1);
+ return AxKit::XSP::WebUtils::redirect(\$redirect,undef,undef,1);
}
}
}
}
+# catch the case where IE submitted the form without any buttons used
+if (\$cgi->param('__submitting_$name') && !\$_form_ctxt->{_Failed}) {
+ no strict 'refs';
+ my \$redirect;
+ if (my \$sub = \$package->can('$onsubmit')) {
+ \$redirect = \$sub->(\$_form_ctxt);
+ }
+ if (\$redirect) {
+ return AxKit::XSP::WebUtils::redirect(\$redirect, undef, undef, 1);
+ }
+}
}
EOT
@@ -910,6 +921,11 @@
buttons support C<onsubmit> attributes. Cancel buttons support C<oncancel>
attributes. Forms themselves support both C<oncancel> and C<onsubmit>
attributes.
+
+If a form is submitted without pressing a button (such as via JavaScript,
+or by hitting <Enter>, then the form tag's C<onsubmit> callback will be
+used. It is always sensible to define this to be one of your button's
+submit callbacks.
All tags allow a C<disabled> attribute. Set this to a true value (i.e.
C<disabled="1">) to set the control to disabled. This will be interpreted