Opened 14 years ago
Closed 13 years ago
#2416 closed defect (invalid)
dojo.widget.Form.getValues() ignore fields with names contains "["
Reported by: | Owned by: | Nathan Toone | |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Dijit | Version: | 0.4.2 |
Keywords: | widget, form, getValues | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description (last modified by )
when using form elements in this form (array of the same input element):
<input type="text" name="field[0]" id="field[0]" /> <input type="text" name="field[1]" id="field[1]" /> <input type="text" name="field[2]" id="field[2]" /> ...
the dojo.widget.Form.getValues() function ignore those form elements.
my patch to fix that problem:
--- Form.js 2007-01-10 15:53:52.000000000 +0200 +++ FormPatched.js 2007-02-06 13:51:41.000000000 +0200 @@ -287,10 +287,12 @@ if ((elm.type != "select-multiple" && elm.type != "checkbox" && elm.type != "radio") || (elm.type=="radio" && elm.checked)) { if(name == name.split("[")[0]) { - myObj[name]=elm.value; - } else { - // can not set value when there is no name - } + myObj[name]=elm.value; + } else if (name != 'undefined' && name != '') { + myObj[name] = elm.value; + } else { + // can not set value when there is no name + } } else if (elm.type == "checkbox" && elm.checked) { if(typeof(myObj[name]) == 'undefined') { myObj[name]=[ ];
Attachments (1)
Change History (9)
comment:1 Changed 14 years ago by
Milestone: | 0.4.2 → 0.9 |
---|
comment:2 Changed 14 years ago by
comment:3 Changed 14 years ago by
Component: | Widgets → Dojox |
---|---|
Milestone: | 0.9 |
Owner: | changed from bill to joose |
Changed 14 years ago by
Attachment: | patch-form.patch.txt added |
---|
Patch to Form ("array"-bugfix, validation fixes, coding convention fixes)
comment:4 Changed 14 years ago by
I don't think that suggested solution will work, because it doesn't do anything for setValues thingie. And I think the solution suggested will not work =)
Anyway, patch included which fixes this text-array thingie. Patch also adds more support for Validation widgets and fixes some coding conventions.
comment:5 Changed 13 years ago by
Milestone: | → 1.2 |
---|---|
Summary: | dojo.widget.Form.getValues() ignore fields with names contaisn "[" → dojo.widget.Form.getValues() ignore fields with names contains "[" |
Test in 1.2 timeframe, see if the issue remains. If so, let's get it fixed.
comment:6 Changed 13 years ago by
Component: | Dojox → Dijit |
---|
comment:7 Changed 13 years ago by
Description: | modified (diff) |
---|---|
Owner: | changed from joose to Nathan Toone |
comment:8 Changed 13 years ago by
Milestone: | 1.2 → tbd |
---|---|
Resolution: | → invalid |
Status: | new → closed |
I don't know if this is an issue or not.
The documentation of dijit.form.Form.getValues states that it only works on widget form elements. So I don't think that the original issue remains.
Closing for now - if desired, a separate issue could be logged to support getValues for non-widget input elements (though in looking at the code, it appears that at one time it existed, and was removed for some reason...I don't know what that reason would have been.)
ziv,
have you filed a CLA? (http://dojotoolkit.org/icla.txt) or has your company filed a CCLA?
Regards