Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-12273

rich:fileUpload does not work in portlets because it does not utilize javax.faces.encodedURL for the XmlHttpRequest URL

    Details

      Description

      The fileupload.js JavaScript resource has a bug such that it uses the form's "action" attribute as the XmlHttpRequest URL, rather than the "javax.faces.encodedURL" hidden field value.

      I think this is where the problem exists:

                  __submit: function() {
                      var originalAction = this.form.attr("action");
                      var originalEncoding = this.form.attr("encoding");
                      var originalEnctype = this.form.attr("enctype");
                      try {
                          var delimiter = originalAction.indexOf("?") == -1 ? "?" : "&";
                          this.form.attr("action", originalAction + delimiter + UID + "=" + this.loadableItem.uid);
                          this.form.attr("encoding", "multipart/form-data");
                          this.form.attr("enctype", "multipart/form-data");
                          richfaces.submitForm(this.form, {"org.richfaces.ajax.component": this.id}, this.id);
                          richfaces.Event.fire(this.element, "onfilesubmit", this.loadableItem.model);
                      } finally {
                          this.form.attr("action", originalAction);
                          this.form.attr("encoding", originalEncoding);
                          this.form.attr("enctype", originalEnctype);
                          this.loadableItem.input.removeAttr("name");
                      }
                  },

      Until this is fixed, the component will not function in a portlet environment.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  kenfinni Ken Finnigan
                  Reporter:
                  ngriffin7a Neil Griffin
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: