Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Event handler for FileItem

    I'm trying to get control when a user browses a file name into the FileItem field. I have tried adding ChangedHandler, ChangeHandler, and ClickHandler.

    None of these handlers get control when the user browses a file name. Here is the code:

    Code:
    final FileItem upload = new FileItem(Schema.DSF_UPLOADEDFILE);
    upload.setShowTitle(false);
    upload.setEndRow(false);
    upload.setWidth(Dimensions.STANDARD_CELL_WIDTH * 2);
    final String FILE_NAME_VALIDATION = ".*\\.xlsx";
    RegExpValidator regExpValidator = new RegExpValidator();
    regExpValidator.setExpression(FILE_NAME_VALIDATION);
    regExpValidator.setErrorMessage("must be a Microsoft Excel file ending with .xlsx");
    upload.setValidators(regExpValidator);
    upload.setValidateOnChange(true);
    upload.addChangedHandler(new ChangedHandler() {
    
    	@Override
    	public void onChanged(ChangedEvent event) {
    		Object getValue = upload.getValue();
    		ClientLogger.log(this, "getValue=", getValue);
    	}
    });
    upload.addChangeHandler(new ChangeHandler() {
    
    	@Override
    	public void onChange(ChangeEvent event) {
    		Object getValue = upload.getValue();
    		ClientLogger.log(this, "getValue=", getValue);
    	}
    });
    upload.addClickHandler(new ClickHandler() {
    
    	@Override
    	public void onClick(ClickEvent event) {
    		Object getValue = upload.getValue();
    		ClientLogger.log(this, "getValue=", getValue);
    	}
    });
    In the code above none of the handlers get control when a file name is browsed into the file name text box of the FileItem.

    #2
    We've made a change to address this. Please try the next nightly build dated June 21 or above

    Thanks
    Isomorphic Software

    Comment


      #3
      FileItem failing after 3.1-p20130620 release

      Originally posted by Isomorphic View Post
      We've made a change to address this. Please try the next nightly build dated June 21 or above

      Thanks
      Isomorphic Software
      I downloaded the most recent release (3.1-p20130704) and found that FileItem is no longer working properly. The fields UploadedFile_filename, UploadedFile_filesize, and UploadedFile_date_created are no longer being updated in the database row of the uploaded file.

      I tried many different releases and found that FileItem properly uploads with release 3.1-p20130620 and previous releases but fails with all releases of 3.1-p20130621 and after.

      The failure occurs in the sample code in the previous post.

      I obviously don’t know what changed but I suspect that the changes made to fix the original bug I reported are causing the failure I’m now describing.

      Comment


        #4
        You've hit a temporary regression, that was already fixed yesterday - please retest with a build dated July 5 or later

        Comment


          #5
          Originally posted by Isomorphic View Post
          You've hit a temporary regression, that was already fixed yesterday - please retest with a build dated July 5 or later
          I have tried three releases with these results:

          2013-06-20:
          • All three event handlers never get called
          • FileItem.getValue method returns an array of strings where the first string is the name of the file.
          • DynamicForm.uploadData() properly uploads the file and updates the file name, files size, and date created fields.



          2013-06-21:
          • All three event handlers are called.
          • When the event handlers for ChangeHandler and ChangedHandler are called the FileItem.getValue method returns an array of strings where the first string is the name of the file.
          • When the event handler for ClickHandler is call the FileItem.getValue method returns null
          • DynamicForm.uploadData() does not properly upload the file and file name, files size, and date created fields are not updated.


          Here is the log that shows the result of the event handlers:

          Code:
          20:53:18.134:MUP5:INFO:Log:Orchestrate: viewer.shared.forms.Items$13$3: ClickHandler: getValue=null
          20:53:20.779:MMV9:INFO:Log:Orchestrate: viewer.shared.forms.Items$13$2: ChangeHandler: getValue=[C:\fakepath\List.xlsx]
          20:53:20.780:MMV9:INFO:Log:Orchestrate: viewer.shared.forms.Items$13$1: ChangedHandler: getValue=[C:\fakepath\List.xlsx]
          2013-07-07:
          • All three event handlers are called.
          • When all three event handlers are called FileItem.getValue returns null and FileItem.getValue is always null.


          Here is the log that shows the result of the event handlers:

          Code:
          20:59:39.779:MUP5:INFO:Log:Orchestrate: viewer.shared.forms.Items$13$3: ClickHandler: getValue=null
          20:59:42.644:MMV8:INFO:Log:Orchestrate: viewer.shared.forms.Items$13$2: ChangeHandler: getValue=null
          20:59:42.644:MMV8:INFO:Log:Orchestrate: viewer.shared.forms.Items$13$1: ChangedHandler: getValue=null
          Last edited by dbscott525; 7 Jul 2013, 20:07.

          Comment


            #6
            The issue that FileItem.getValue() was always null is now fixed for tomorrow's 9.1, 9.0 and 8.3 builds.

            Comment


              #7
              Originally posted by Isomorphic View Post
              The issue that FileItem.getValue() was always null is now fixed for tomorrow's 9.1, 9.0 and 8.3 builds.
              I'm not sure what you are referring to in regards to 9.1, 9.0 and 8.3 builds.

              I just downloaded SmartGWT 3.1-P20130714. With this version none of the event handlers described in this thread get control. However, getValue does return the name of the file.

              Comment


                #8
                Wrong SmartGWT Version

                You can disregard the last few posts. It turned out even though I though I was using the latest SmartGWT version I was actually using an older version. This was because the .jar files were still in the target are and not being updated by Eclipse.

                Comment

                Working...
                X