Closed Bug 394855 Opened 18 years ago Closed 15 years ago

Dynamically set form action attribute does not work correctly.

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: david.canadas.mazo, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.8.1.6) Gecko/20070725 Mozilla Gecko Firefox/2.0.0.5 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.8.1.6) Gecko/20070725 Mozilla Gecko Firefox/2.0.0.5 I have a very huge web application with a lot of JS. I give you an excerpt of the problem: MyClass.fileSaveUri = 'http://intranet.myprojects.xyz/forms/handlers/save'; var form = document.createElement('form'); form.setAttribute('action', MyClass.fileSaveUri); If I do alert(form.getAttribute('action')) result is http://intranet.myprojects.xyz/intranet.myprojects.xyz/forms/handlers/save instead the right address. Additionally, assigning the http://.... string directly to form.setAttribute('action', 'http://....') works. Reproducible: Sometimes Steps to Reproduce: 1. Create an Iframe using JS. 2. From the top document, using JS, create a form in the iframe. 3. Create an object of any class with an static variable called 'uri' with a URL string as a value in the top document. 4. Assign the static variable to the action attribute of the form in the iframe. Actual Results: Hostname in the "action" attribute gets duplicated. Expected Results: The assigned URL. Observed that first time you submit the form, even if form.action suffers the bug, form submits right. Second time you create the form in the same JS instance the submission fails. Doing this seems to hack the problem: if(form.action.indexOf(window.location.hostname + '/') != form.action.lastIndexOf(window.location.hostname + '/')) { form.action = form.action.replace(window.location.hostname + '/', ''); }
This seems likely to be a bug in your application rather than a bug in Gecko. Could you attach a minimized testcase that demonstrates the problem? Reducing a testcase might make it clearer where the problem actually lies.
Assignee: general → nobody
Component: JavaScript Engine → DOM
QA Contact: general → general
Thanks for your answer. You're probably right, It should be a problem with my application (too many lines, doh). At this time, I'm using my computer at home and the error seems not present (I have same FF running in both home and office computer but using different addons). Anyway, same FF version but my application shows different behaviors in some cases. I cannot post my complete case because there are 15000+ JavaScript lines and some of them are confidential or copyrighted by my company. I will try to write a working testcase on the office then post it here. I leave the bug as unconfirmed till tomorrow and I will see if I can reproduce the bug or I will close the bug as INVALID. Thanks. Cheers.
David, I'm resolving this bug as invalid because it really looks like and updating action with .action or @action works for me. Please, feel free to reopen it if you have any update.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.