<field name="myname" type="checkbox" value="12" label="mylabel" />
If we load the form input the default value of 1 would load instead of 12.
There are two things with this "issue":
First you usually don't set an actual value in the XML. You can use default
to set a default value, which is probably what you want?
Second, default values don't work for checkboxes due to the way a checkbox work in HTML.
@Bakual You are probably right, but then the value atribute should be removed from formFieldCheckbox. And even though, If default="<value>"
is selected, the checkbox is automatically checked which is not always wanted.
I noticed becouse I updated a site from 3.1.5 to 3.2.2 and Javascript started to fail. At 3.1.5 it was working as expected.
Yep, that's why I said default values don't work for checkboxes. That's due to the way HTML checkboxes work.
The value
attribute would actually be used to assign a value to the checkbox which is sent when it's enabled. Similar to an option in a select list. It doesn't say if it's enabled or not, but what value is sent together with it's name when checked. This does indeed not work currently. But then, usually you don't need this anyway as we would just set it to 1
in most cases and check the presence (not the value) of the checkbox in POST.
But it's an issue which someone could fix
Also, docpage is found here: http://docs.joomla.org/Checkbox_form_field_type
Closing in favour of the referenced trcker so that comments only take place in one place
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-07-23 15:09:42 |
Labels |
Added:
?
|
yes it is happening. I have a fix. Making a tracker and PR for it.