Opened 10 years ago

Last modified 3 years ago

#9962 open enhancement

Form: return scalar for single checkbox

Reported by: bill Owned by:
Priority: high Milestone: 1.15
Component: Dijit - Form Version: 1.3.2
Keywords: Cc:
Blocked By: Blocking:

Description

Currently the form widget always treats checkboxes as arrays, even when there's only a single checkbox. For example, in a form like:

<form dojoType=dijit.form.Form>
   <dojoType=dijit.form.Checkbox name=myCheckbox>
</form>

Then Form.getValue() will return {myCheckbox: ["on"]} or {myCheckbox: []} rather than the simpler {myCheckbox: "on"} or {} .

See also the code added for #8426. Checkboxes have a special code path but maybe after this change they can share the code for that ticket.

Attachments (2)

_FormMixin.patch (1.9 KB) - added by sunxcint 6 years ago.
patch for dijit/form/_FormMixin.js
Form_test.patch (4.9 KB) - added by sunxcint 6 years ago.
patch for test cases

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by bill

Component: DijitDijit - Form
Owner: set to Douglas Hays

Changed 6 years ago by sunxcint

Attachment: _FormMixin.patch added

patch for dijit/form/_FormMixin.js

Changed 6 years ago by sunxcint

Attachment: Form_test.patch added

patch for test cases

comment:2 Changed 6 years ago by sunxcint

For the form in the ticket description, Form.getValue() will return {myCheckbox: "on"} or {myCheckBox: null} .

comment:3 Changed 6 years ago by Douglas Hays

Owner: Douglas Hays deleted
Status: newassigned

comment:4 Changed 6 years ago by Douglas Hays

Status: assignedopen

comment:5 Changed 4 years ago by dylan

Milestone: 2.01.12

Very outdated patch unfortunately, but should probably be considered for 1.12.

comment:6 Changed 3 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.