MrHackett / iui

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

Make Ajax form submits properly handle checkboxes, radio buttons, multiple submit buttons, and disabled inputs. #48

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
While testing an app which uses many checkboxes, I noticed that iUI
submitted l the data even though I checked only one of the boxes.

I attached a patch that should fix the problem.

Original issue reported on code.google.com by adpenara...@gmail.com on 23 Nov 2007 at 3:30

Attachments:

GoogleCodeExporter commented 8 years ago
Know it's an old log but I just had the same issue, and the provided patch 
fixed the issue.
[Note had to fix the POST issue first to get this far]

Original comment by isambard...@gmail.com on 11 May 2009 at 7:28

GoogleCodeExporter commented 8 years ago

Original comment by msgilli...@gmail.com on 31 Jul 2009 at 6:34

GoogleCodeExporter commented 8 years ago
Seems, that the patch isn't working on 0.40. With the patch the browser does 
not send
the post request. But I don't know why this is not working. Any ideas?

Original comment by matus...@gmail.com on 4 Dec 2009 at 10:08

GoogleCodeExporter commented 8 years ago
Oops, my mistake. Use of args has been changed in 0.40. Seems to work now with 
an
adapted patch.

Original comment by matus...@gmail.com on 4 Dec 2009 at 10:15

GoogleCodeExporter commented 8 years ago
Today I added a checkbox to my App and discovered the same issue in iui-0.31. I 
have solved it by changing this function as follows:

function encodeForm(form)
{
    function encode(inputs)
    {
        for (var i = 0; i < inputs.length; ++i)
        {
            if (inputs[i].name) {
                if (inputs[i].type != "checkbox" || inputs[i].checked)
                    args.push(inputs[i].name + "=" + escape(inputs[i].value));
            }
        }
    }

    var args = [];
    encode(form.getElementsByTagName("input"));
    encode(form.getElementsByTagName("textarea"));
    encode(form.getElementsByTagName("select"));
    return args;    
}

Original comment by systemun...@gmail.com on 1 Feb 2011 at 9:54

GoogleCodeExporter commented 8 years ago

Original comment by msgilli...@gmail.com on 25 Sep 2011 at 11:38

GoogleCodeExporter commented 8 years ago

Original comment by msgilli...@gmail.com on 22 Mar 2012 at 12:41

GoogleCodeExporter commented 8 years ago
Issue 67 has been merged into this issue.

Original comment by msgilli...@gmail.com on 22 Mar 2012 at 12:43

GoogleCodeExporter commented 8 years ago
Issue 77 has been merged into this issue.

Original comment by msgilli...@gmail.com on 22 Mar 2012 at 12:44

GoogleCodeExporter commented 8 years ago
Issue 72 has been merged into this issue.

Original comment by msgilli...@gmail.com on 22 Mar 2012 at 12:45

GoogleCodeExporter commented 8 years ago
I have a proposed fix in my "dev" clone.  You can view and review (!) the code 
here:
http://code.google.com/r/msgilligan-iui-dev/source/detail?r=2335ea9d3351d3fba1fe
895683776be73f7222e2&name=msgilligan-issue72

I also created some tests and published them here
http://stage.iui-js.org/test/form-test.html#_arrays (to test Radios and 
Checkboxes)
and 
http://stage.iui-js.org/test/form-test.html#_submits (to test multiple submit 
buttons and disabled inputs)

Original comment by msgilli...@gmail.com on 22 Mar 2012 at 1:51

GoogleCodeExporter commented 8 years ago

Original comment by msgilli...@gmail.com on 25 Mar 2012 at 7:54

GoogleCodeExporter commented 8 years ago
Issue 239 has been merged into this issue.

Original comment by msgilli...@gmail.com on 3 Apr 2012 at 9:59

GoogleCodeExporter commented 8 years ago
Issue 249 has been merged into this issue.

Original comment by msgilli...@gmail.com on 10 Apr 2012 at 12:31