click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r780438 - /incubator/click/trunk/click/framework/src/org/apache/click/control/FileField.java
Date Sun, 31 May 2009 14:36:20 GMT
Author: sabob
Date: Sun May 31 14:36:20 2009
New Revision: 780438

URL: http://svn.apache.org/viewvc?rev=780438&view=rev
Log:
improved filefield validation to render a message if the field is required

Modified:
    incubator/click/trunk/click/framework/src/org/apache/click/control/FileField.java

Modified: incubator/click/trunk/click/framework/src/org/apache/click/control/FileField.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/control/FileField.java?rev=780438&r1=780437&r2=780438&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/control/FileField.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/control/FileField.java Sun
May 31 14:36:20 2009
@@ -316,10 +316,9 @@
     public void validate() {
         setError(null);
 
-        FileItem fileItem = getFileItem();
-
-        if (fileItem != null) {
-            if (isRequired() && StringUtils.isBlank(fileItem.getName())) {
+        if (isRequired()) {
+            FileItem fileItem = getFileItem();
+            if (fileItem == null || StringUtils.isBlank(fileItem.getName())) {
                 setErrorMessage("file-required-error");
             }
         }



Mime
View raw message