DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17031>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17031

Validation of required html:file elments passes when no file selected in form

           Summary: Validation of required html:file elments passes when no
                    file selected in form
           Product: Struts
           Version: 1.1 Beta 3
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validator Framework
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When using <html:file> form elmenents, the JavaScript validation of these
elements passes the "required" test when I have not selected any file to upload.
Then in the servlet validation of the ValidatorForm object the file elements
pass validation again. I'm not sure if this is desired behavior or not, but for
me it was not. To get around (in the servlet validation anyway) my form bean's
validate method has code that checks the upload file's size, like tihs:

public class MyFormBean extends ValidatorForm {
  private FormFile file;
  ...
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errs = super.validate(mapping, request);
    if ( file == null || file.getFileSize() < 1 ) {
      errs.add(ActionErrors.GLOBAL_ERROR

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to