pkdevbox / iui

Automatically exported from code.google.com/p/iui
MIT License
0 stars 0 forks source link

showPageByHref fails if a child element has name 'action' or 'method' #291

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an iUI page with a form that successfully submits and takes you to a 
valid page.
2. Functionality will cease if a form child element is added that has 
name="action" or name="method".

What is the expected output? What do you see instead?
Expected action is for form submission to occur to the form's ACTION parameter, 
with the data from the HTML form element named action to be passed along with 
all the rest.
Instead, iUI attempts to submit form to the element's property, resulting in a 
log entry in my access_log like so:
File does not exist: /var/www/html/[object HTMLInputElement]
and a 404 Not Found error on the device itself.

SOLUTION:

I have fixed iui.js (line 607) by changing:
iui.showPageByHref(form.action, encodeForm(form), form.method || "GET", null, 
clear);
to:
iui.showPageByHref(form.getAttribute('action'), encodeForm(form), 
form.hasAttribute('method') ? form.getAttribute('method') : 'GET', null, clear);

This solves my problem (I had an element named 'action') as well as the same 
potential problem if an element were to be named 'method'.

Original issue reported on code.google.com by eslind...@gmail.com on 29 Jul 2011 at 7:35

GoogleCodeExporter commented 8 years ago
This looks like a good patch to me.

Original comment by msgilli...@gmail.com on 10 Apr 2012 at 1:42

GoogleCodeExporter commented 8 years ago

Original comment by msgilli...@gmail.com on 11 Apr 2012 at 11:14