Opened 11 years ago

Closed 3 years ago

Last modified 3 years ago

#6009 closed enhancement (patchwelcome)

CheckBox: support required=true

Reported by: nonken Owned by:
Priority: high Milestone: 2.0
Component: Dijit - Form Version: 1.0
Keywords: CheckBox, required Cc:
Blocked By: Blocking:

Description (last modified by dante)

In some use-cases you want checkboxes to be required to be checked. Typical example is "do you agree to these license terms?" in an install wizard.

Also wondering about radio field. Are there cases where you first set no checked value and then have a required one?

Change History (19)

comment:1 Changed 11 years ago by bill

Cc: nathan@… added
Component: DijitDojox
Description: modified (diff)
Milestone: 1.2
Owner: set to Adam Peller
Summary: dijitCheckBox, isValid supportCheckBox: support required=true

Marking for consideration for 1.2. This is probably a dojox.form thing more than a dijit thing? Not sure.

comment:2 Changed 11 years ago by bill

Component: DojoxDojoX Form
Owner: changed from Adam Peller to dante

comment:3 Changed 11 years ago by nathan

Cc: nathan added; nathan@… removed

comment:4 Changed 11 years ago by nonken

I'd keep it in dijit since this functionality is quite essential for form handling. The above use cases appear on almost every site which deals with usersignups, sales or other e-commerce

comment:5 Changed 11 years ago by nathan

I tend to agree - I don't think this is so much a "new" widget as a mechanism for adding support for isValid and validate to the existing widget.

comment:6 Changed 11 years ago by guest

I made some suggestions about CheckBox? enhancements on #6388. I think adding validate, isValid, and required would be valuable for checkboxes. They should also have an errorMessage attribute, which is displayed next to the checkbox when it's invalid.

comment:7 Changed 11 years ago by dante

Cc: nathan removed
Description: modified (diff)
Owner: changed from dante to Nathan Toone

comment:8 Changed 11 years ago by nathan

Owner: changed from Nathan Toone to nathan

comment:9 Changed 11 years ago by nathan

Status: newassigned

comment:10 Changed 11 years ago by nathan

Milestone: 1.21.3
Status: assignednew

comment:11 Changed 11 years ago by Nathan Toone

Owner: changed from nathan to Nathan Toone

comment:12 Changed 10 years ago by bill

Milestone: 1.3future

comment:13 Changed 9 years ago by Nathan Toone

Owner: Nathan Toone deleted

Unassigning my tickets.

comment:14 Changed 6 years ago by dylan

Milestone: future1.9
Owner: set to wildbill
Status: newassigned

Is this really not yet supported by dijit/Form?

comment:15 Changed 6 years ago by bill

Component: DojoX FormDijit - Form
Milestone: 1.92.0
Owner: changed from wildbill to Douglas Hays

The question doesn't really make sense. Widgets support their own "required" flag.

It's not possible to do that for CheckBox etc. in 1.9 given that there's no place for an exclamation mark invalid icon to be displayed as part of the widget, but something to reconsider for 2.0, so leaving this open.

comment:16 Changed 5 years ago by Douglas Hays

Owner: Douglas Hays deleted
Status: assignedopen

comment:17 Changed 3 years ago by dylan

Bill, have you addresses this with Delite/Deliteful?? Can we close this out as patchwelcome?

comment:18 Changed 3 years ago by bill

Resolution: patchwelcome
Status: openclosed

It's not addressed in deliteful, but we can close as patchwelcome.

comment:19 Changed 3 years ago by gaxweb

The only problem here is showing a visual indication. Maybe the label should be part of the widget, so you have something to work with? How often do you use a checkbox without a label? Exactly. But wrap it around the checkbox, don't use an extra one. Makes layout much easier and less error prone.

HTML5 forms show a tooltip, pointing at the checkbox btw.

Nonetheless, I think it's worth it to at least support the required flag along with a validate() method, so you can at least wrap a Form widget around the checkboxes, so the form's validate() method will automatically (the form calls each widget's validate() method already: https://github.com/dojo/dijit/blob/master/form/_FormMixin.js#L72) consider them during validation. That would at least put them on equal footing with plain HTML form validation, and not make it worse.

Last edited 3 years ago by gaxweb (previous) (diff)
Note: See TracTickets for help on using tickets.