Opened 14 years ago
Closed 14 years ago
#2869 closed task (fixed)
Checkbox, Radio: api to set/get checked state
Reported by: | bill | Owned by: | davidb |
---|---|---|---|
Priority: | high | Milestone: | 0.9beta |
Component: | Widgets | Version: | 0.9 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
See related dijit forum topic.
Most form widgets have setValue()/getValue() methods but for checkbox and radio buttons, the "value" field is more like the name field; what you need is a function to get/set the checked state.
Example code to illustrate problem:
<input type=radio name=seatType value=coach checked> <input type=radio name=seatType value=business> <input type=radio name=seatType value=firstClass>
For a given input we want the ability to set whether or not it is "checked", not what the value (coach/business/firstClass) is.
Attachments (3)
Change History (9)
Changed 14 years ago by
Attachment: | checkedapi.diff added |
---|
comment:1 Changed 14 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 14 years ago by
Status: | new → assigned |
---|
Changed 14 years ago by
Attachment: | checkedapi2.diff added |
---|
this solution might be better; just adds api to Checkbox.js (reposting to add this comment)
comment:3 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Changed 14 years ago by
Attachment: | checkedapifix.diff added |
---|
this improves the solution (setChecked updates view, removed unecessary aria etc)
comment:4 Changed 14 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Hi Bill,
Could you please commit the checkedapifix.diff patch I just added? It makes sure the view is updated when the user calls setChecked; it also removes some ARIA stuff that I accidentally borrowed when pasting code from my FormElement? solution.
I've been adding some tests for checkbox/radio but am not ready to commit the them just yet, and can do that on another ticket.
comment:6 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
a quick first attempt, adding checked state API to FormElement?.js and using it in Checkbox.js