[
https://issues.jboss.org/browse/RF-13719?page=com.atlassian.jira.plugin.s...
]
Ken Finnigan commented on RF-13719:
-----------------------------------
[~jtrantin], this seemed somewhat familiar when looking at it today, and I discovered
RF-12273.
RF-12273 actually introduced the code you refer to in fileUpload.js above, and it was
introduced to make the component work in a portlet environment. Without that change,
it's not possible to upload files in a portlet at all.
There may be a bug somewhere, but as fileUpload is usually used in an Ajax form, without a
non Ajax submit, I don't think it's something that has been tested.
Not sure if any of that is much help or not
rich.fileUpload breaks form action in portal
--------------------------------------------
Key: RF-13719
URL:
https://issues.jboss.org/browse/RF-13719
Project: RichFaces
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: component-input
Affects Versions: 4.3.5
Environment: JBoss Portal 6.1.1
Reporter: Jonáš Trantina
Labels: gss
Attachments: reproducer.zip, reproducer2.zip
When a rich:fileUpload si submitted (i.e. files are uploaded) action of the form is not
preserved well.
In fileupload.js __submit method there is the following code:
{code:JavaScript}
var encodedURLInputs =
this.form.children("input[name='javax.faces.encodedURL']");
var originalAction = encodedURLInputs.length > 0 ? encodedURLInputs.val() :
this.form.attr("action");
{code}
the var "originalAction" is then used to revert to the original action url of
the form. However, encodedURLInputs and form action prop does not contain the same url.
Because encodedURLInputs has bigger priority URL from that input is restored into the form
and not the original form action. This breaks the form as the next submission fails.
In portal the solution is
{code:JavaScript}
var originalFormAction =this.form.attr("action");
{code}
and then restore "originalFormAction" instead of "originalAction",
but I am not sure if this doesn't break anything in other environments.
Is this a bug in richfaces or is the content of
input[name='javax.faces.encodedURL'] set badly?
To reproduce you can use the reproducer attached.
Example URLs:
form action
{code}
/portal/classic/home/uploadform?portal:componentId=834fa198-ff3d-4a5c-a1c7-33c85e8a410d&interactionstate=JBPNS_rO0ABXcsABBfanNmQnJpZGdlVmlld0lkAAAAAQALL2hvbWUueGh0bWwAB19fRU9GX18*&portal:type=action
{code}
input[name='javax.faces.encodedURL']
{code}
/portal/classic/home/uploadform?portal:windowState=normal&portal:componentId=834fa198-ff3d-4a5c-a1c7-33c85e8a410d&portal:cacheLevel=PAGE&resourcestate=JBPNS_rO0ABXdAABBfanNmQnJpZGdlVmlld0lkAAAAAQALL2hvbWUueGh0bWwACF9wYnJBamF4AAAAAQAEdHJ1ZQAHX19FT0ZfXw**&portal:type=resource&portal:portletMode=view
{code}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)