Version 4.3
I noticed in CheckboxField the value is hardcoded to either 0/1 and makes sense as it's boolean however we are building something based on a bad government standard that basically says if the user is vision impaired send code 17. In the front end would be nice to go name="vision" value="17" so we don't have to remap the values in the backend.
My main reason though for suggesting a change to allow more than 1/0 in the value is it's allowed in the HTML Spec.
I think it could break some peoples forms though, as the value is set through the 3rd parameter in ::create people relying on 1/0 will now be getting unexpected values.
Interesting! Would you be able to reference the standard you鈥檙e referring to?
https://www.ncver.edu.au/__data/assets/pdf_file/0022/62383/AVETMISS_Data_element_definitions_2_3.pdf on page 71 is what I'm referring to. You can see the various disabilities and then the corresponding code they want.
Hi @Rudigern, thanks for that. I've had a bit of a skim read over that, I'm unsure whether the description of that field fits with a CheckboxField to be honest. Perhaps it would be better as a DropdownField with key value options?
We aim to conform to WCAG 2.0 guidelines for accessibility - I can't see anything obvious in the spec relating to this identifier.
I have a feeling that this request should be fulfilled in user code rather than core - what do you think about the above?
Hi @robbieaverill, that particular field you can have one or many fields, ie you suffer vision and mental impairment. I'm not sure the reference to accessibility, the vision impairment is just an example of data, not a reference to WCAG.
It's just the example that brought it up. We've already solved it in our code however if it's valid HTML shouldn't the framework support it, rather than custom code?
I'm not convinced that it is valid HTML... a checkbox is a boolean value
In the Mozilla web docs it specifically describes the use of the value property for a checkbox.
馃槅TIL
I'm wondering if the CheckboxSetField would be a better fit here.
Basically you would have something like this.
$disabilities = CheckboxSetField::create(
'Disabilities',
'If you indicated the presence of a disability, impairment or longterm condition, please select the
area(s) in the following list.',
[
11 => 'Hearing/deaf',
12 => 'Physical',
13 => 'Intellectual',
14 => 'Learning',
15 => 'Mental illness',
16 => 'Acquired brain impairment',
17 => 'Vision',
18 => 'Medical condition',
19 => 'Other',
]
);

I had no idea that existed. I think that would be the better option and more in line with the use case. I'll leave @robbieaverill to close though.
As there are options available for a define the value and means no compatibility issues I'll close this.