Announcement

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

    FileItem is cleaned in IE after selecting file

    (SC_SNAPSHOT-2011-04-26/PowerEdition Deployment 2011-04-26)
    Browser: Internet Explorer 8

    Hello,

    If I select a file in a FileItem in internet explorer (when deployed), the value is immediately cleaned (visually) in the little white input box that shows the path normally.

    In other browsers it works.

    Any idea how this is possible? I am using pretty standard code for my form:
    Code:
    DynamicForm uploadForm = new DynamicForm();
    
    FileItem uploadItem = new FileItem("backgroundFilename");
    HiddenItem idField = new HiddenItem("Flavour_id");
    
    uploadForm.setDataSource(myDs);
    uploadForm.editRecord(record);
    uploadItem.setTitle("Background");
    uploadForm.setFields(idField,uploadItem);
    Is this a bug, or am I doing something wrong?

    My form is placed inside a VLayout, which is placed inside a VLayout, which is placed inside a Window. (Not sure if this makes a difference, but just stating this anyway)
    Last edited by Sytematic; 4 May 2011, 04:32.

    #2
    Brief regression in nightlies, fixed about a week ago.

    Comment


      #3
      Wow, thanks for the quick reply. Downloading the new version.

      Comment


        #4
        We encountered the same problem, with UploadItem in IE 9, when we upgraded to SmartGWT 2.5-pro-20110426 (Chrome and Firefox worked as expected). So we upgraded to SmartGWT 2.5-pro-20110512 and that fixed the IE 9 UploadItem issue.

        However, we now have a different problem with Chrome and Firefox.

        Perhaps we need to upgrade GWT?

        Win 7 64-bit
        JDK 64-bit: 1.6.0_24
        GWT: 2.1.0
        SmartGWT: 2.5-pro-20110512
        Chrome: 11.0.696.68
        Firefox: 4.0.1


        Code:

        public class ArchiveUploadForm extends GenericForm {

        private UploadItem archive;
        private DynamicForm form;
        private NamedFrame frame;
        private VLayout vl;

        public ArchiveUploadForm(final CommonPage parent) {

        archive = new UploadItem("archive");

        archive.setAlign(Alignment.LEFT);
        archive.setTooltip("Select a .zip archive for upload to the server");
        archive.setTextAlign(Alignment.LEFT);
        archive.setAttribute("value", "...");
        archive.setShowTitle(false);
        archive.setVisible(true);
        archive.setRequired(true);
        archive.setWidth(330);
        archive.setStartRow(true);

        MaskValidator val = new MaskValidator();

        val.setMask("([a-zA-Z]:(\\w+)*\\[a-zA-Z0_9]+)?.[zZ][iI][pP]");
        val.setErrorMessage("Selected file must be a .zip archive.");

        archive.setValidators(val);

        form = new DynamicForm();

        form.setEncoding(Encoding.MULTIPART);
        form.setHeight100();
        form.setWidth100();

        form.setNumCols(3);

        frame = new NamedFrame("foo");
        frame.setWidth("1");
        frame.setHeight("1");
        frame.setVisible(false);

        form.setAction(GWT.getModuleBaseURL() + "zipUpload");
        form.setTarget(frame.getName());

        form.setItems(archive);

        save.setTitle(Messages.upload());

        save.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {

        if (form.validate()) {

        form.submitForm();
        window.destroy();
        parent.reload();
        }
        else {

        form.showErrors();
        }
        }
        });

        cancel.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {

        window.destroy();
        }
        });

        vl = new VLayout();

        vl.addMember(form);
        vl.addMember(frame);
        vl.setAlign(Alignment.LEFT);
        vl.setWidth100();

        formLayout.addMember(vl);
        formLayout.addMember(buttonLayout);
        formLayout.setMargin(5);
        formLayout.setHeight100();
        formLayout.setWidth100();

        window.addItem(formLayout);
        window.setTitle(Messages.archiveUpload());
        window.setHeight(125);
        window.setWidth(350);
        }
        }
        Last edited by tellington; 12 May 2011, 11:41.

        Comment


          #5
          No other reports of this. What do you specifically mean by the "same problem"? Have you used Firebug or other tools to verify that no file is being submitted? Have you cleared cache in all tested browsers after installing the new version?

          Comment


            #6
            Originally posted by Isomorphic
            No other reports of this. What do you specifically mean by the "same problem"? Have you used Firebug or other tools to verify that no file is being submitted? Have you cleared cache in all tested browsers after installing the new version?
            I altered my original post to reflect a more accurate statement per your first question. The file chooser logic does indeed work to select a file to be uploaded when using Chrome & Firefox.

            Yes, all the browser caches were cleared.

            The behaviour (when using Chrome and Firefox) seems to indicate the onClick event is either ignored or is not fired.

            I have verified the onClick logic is not executed by reviewing System.out.println() debugging statements.

            Unfortunately, I don't have a workable Firebug because my Firefox auto-upgraded to 4.0.1 and Firebug was deactivated in the process.

            NOTE on Firebug - reinstalling it appears to have made it functional. I will test again and see what I glean from it. Thanks!
            Last edited by tellington; 12 May 2011, 12:11.

            Comment


              #7
              Originally posted by tellington
              I altered my original post to reflect a more accurate statement per your first question. The file chooser logic does indeed work to select a file to be uploaded when using Chrome & Firefox.

              Yes, all the browser caches were cleared.

              The behaviour (when using Chrome and Firefox) seems to indicate the onClick event is either ignored or is not fired.

              I have verified the onClick logic is not executed by reviewing System.out.println() debugging statements.

              Unfortunately, I don't have a workable Firebug because my Firefox auto-upgraded to 4.0.1 and Firebug was deactivated in the process.

              NOTE on Firebug - reinstalling it appears to have made it functional. I will test again and see what I glean from it. Thanks!
              I spoke with my mentor and the fundamental nature of the architecture of our rather large server code base is why we don't run in development or debug mode where we can use something like Firebug.

              I did, however, use the SmartClient Developer Console to compare its log messages for IE 9, Chrome and Firefox.

              So far I don't see anything from Chrome and Firefox to indicate any problems with UploadItem or the button control.

              Comment


                #8
                OK, we're not really following what the problem report is now. You seem to be saying that the control works, but you're mentioning something about onclick. SmartGWT doesn't have onclick although there is a ClickHandler and ClickEvent. What specifically are you trying to do and what's not working?

                Comment


                  #9
                  Thank you for your patience.

                  We upgraded to SmartGWT 2.5-pro-20110426 and that broke IE 9 - the same problem as the person who created this thread.

                  So we upgraded to 2.5-pro-20110512 and that broke Chrome and Firefox in a way such that clicking the upload button, for a given selected file, does not do anything. The submitForm() method either doesn't execute or it does but something blocks it from working.

                  Trial and error has shown that Chrome and Firefox will work, with 2.5-pro-20110512, IF I comment two lines of our code in this class:

                  ...
                  // form.setTarget(frame.getName());
                  ...
                  // vl.addMember(frame);

                  However, commenting those lines reintroduces a problem the frame is meant to correct - to avoid opening an empty page upon upload of the file.

                  Comment


                    #10
                    You appear to have a validator on your UploadItem - that won't work. Browsers are not consistent about even allowing a web page to know the file name.

                    Comment


                      #11
                      Originally posted by Isomorphic
                      You appear to have a validator on your UploadItem - that won't work. Browsers are not consistent about even allowing a web page to know the file name.
                      I can include or exclude the validator and there is no effect on application execution in IE, Chrome or Firefox.

                      I can include or exclude the named frame and that definitely has a cause and effect on application execution:
                      -- Include a named frame: IE works; Chrome and Firefox fail
                      -- Exclude a named frame: IE, Chrome and Firefox work

                      Versions tested:
                      -- GWT 2.1.0 & 2.2.0
                      --SmartGWT 2.5-pro-20110215, -0426 & -0512

                      I have four log files with comprehensive Debug output from the SmartGWT developer console. However, the log files exceed the forum size limit.

                      Is there an FTP or email account to be used for submission of the log files?

                      Construction of a standalone test case is in progress...

                      Comment


                        #12
                        We don't really need log files if you're creating a standalone test case that can actually be run. However, what you now seem to be saying is that you're having browser-specific trouble with something you're doing outside of SmartGWT - we're probably not going to be able to help you with that.

                        Note that the combination of the SmartGWT Server Framework and FileItem provide a robust, codeless solution for file upload that works on all supported browsers without the need to go create frames. There should be an extremely compelling reason not to take this approach, as anything else is more complex and harder to maintain. See the Uploading Files overview for details.

                        Comment


                          #13
                          Originally posted by Isomorphic
                          We don't really need log files if you're creating a standalone test case that can actually be run. However, what you now seem to be saying is that you're having browser-specific trouble with something you're doing outside of SmartGWT - we're probably not going to be able to help you with that.

                          Note that the combination of the SmartGWT Server Framework and FileItem provide a robust, codeless solution for file upload that works on all supported browsers without the need to go create frames. There should be an extremely compelling reason not to take this approach, as anything else is more complex and harder to maintain. See the Uploading Files overview for details.
                          I did indeed follow the guidelines on the page referenced above - DynamicForm, FileItem and UploadItem are all SmartGWT classes.

                          There is a compelling reason to use UploadItem instead of FileItem - when I use FileItem, nothing happens upon execution. No log errors, no exceptions, no contact with our servlet in Tomcat.

                          When I simply change the control to UploadItem, voila, our file upload worked in all three browsers - UNTIL we upgraded SmartGWT.

                          Comment


                            #14
                            This functionality has included samples that work, and works fine in hundreds of apps, so if you're having trouble with it, that's certainly not a reason to veer away from explicitly stated best practices.

                            Go back to FileItem, get rid of your attempts to use frames, and provide the diagnostic information appropriate to get help - always the same stuff - Developer Console warnings and errors, RPC tab contents, server logs, etc.

                            Comment


                              #15
                              Originally posted by Isomorphic
                              This functionality has included samples that work, and works fine in hundreds of apps, so if you're having trouble with it, that's certainly not a reason to veer away from explicitly stated best practices.

                              Go back to FileItem, get rid of your attempts to use frames, and provide the diagnostic information appropriate to get help - always the same stuff - Developer Console warnings and errors, RPC tab contents, server logs, etc.
                              I believe I have held true to 'explicitly stated best practices' given my implementation is noted on this page: http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/docs/Upload.html. This page is referenced in a previous post on this problem and makes no distinction among the various solutions as to any one, or combination of them, being a preferred solution.

                              On 18 May, I offered comprehensive debug log files from the SmartGWT console...and they were refused. I have looked through the server log files and there is nothing there, when the upload fails in Chrome and Firefox, because no data makes it from the browser to the server.

                              To reiterate - with GWT 2.1.0 and SmartGWT Pro 2.5-20110215, the code in my original post works in all the browsers we need it to function in: IE, Chrome and Firefox.

                              We needed to upgrade SmartGWT - at which time the file upload logic began failing in Chrome and Firefox but still works in IE. During the SmartGWT upgrade, our file upload logic did not change.

                              Comment

                              Working...
                              X