Revision: 385
Author: tfenne
Date: 2006-08-16 17:50:38 -0700 (Wed, 16 Aug 2006)
ViewCVS: http://svn.sourceforge.net/stripes/?rev=385&view=rev
Log Message:
-----------
Merging fix for form field focus from trunk to 1.4 branch.
Modified Paths:
--------------
branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java
branches/1.4.x/stripes/src/net/sourceforge/stripes/validation/ValidationErrors.java
Modified: branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java
===================================================================
--- branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java
2006-08-17 00:49:07 UTC (rev 384)
+++ branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/FormTag.java
2006-08-17 00:50:38 UTC (rev 385)
@@ -360,7 +360,7 @@
ValidationErrors errors = bean == null ? null :
bean.getContext().getValidationErrors();
// If there are validaiton errors, select the first field in error
- if (errors != null && errors.size() > 0) {
+ if (errors != null && errors.hasFieldErrors()) {
List<ValidationError> fieldErrors = errors.get(tag.getName());
if (fieldErrors != null && fieldErrors.size() > 0) {
tag.setFocus(true);
Modified:
branches/1.4.x/stripes/src/net/sourceforge/stripes/validation/ValidationErrors.java
===================================================================
---
branches/1.4.x/stripes/src/net/sourceforge/stripes/validation/ValidationErrors.java
2006-08-17 00:49:07 UTC (rev 384)
+++
branches/1.4.x/stripes/src/net/sourceforge/stripes/validation/ValidationErrors.java
2006-08-17 00:50:38 UTC (rev 385)
@@ -115,4 +115,19 @@
return super.put(field, errors);
}
+
+ /**
+ * Returns true if there are field-specific errors present, and false if
there are
+ * only global errors, or no errors at all.
+ *
+ * @return true if field errors exist, false otherwise
+ */
+ public boolean hasFieldErrors() {
+ if ( keySet().contains(GLOBAL_ERROR) ) {
+ return size() > 1;
+ }
+ else {
+ return size() > 0;
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development