]
RH Bugzilla Integration updated RF-13719:
-----------------------------------------
Bugzilla Update: Perform
Bugzilla References:
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}