Hi,
Checked this list and JoomlaCode project and can't find anything about
this.
I'm using JFormFieldCheckboxes in a form to allow users to multi
select options using the Checkboxes list with each box having a binary
flag value (1, 2, 4, 8...). The form then returns an array of the
values checked which is fine as I use array_sum to get the integer
value of the flags added together (stored in the db as a tinyint).
But when showing the form the JFormFieldCheckboxes only accepts one
value: ((string) $option->value == (string) $this->value)
(see line 65, joomla.form.fields.checkboxes)
Because of this it behaves like a radio list, and if you save with
more than one option, none of the checkboxes are ticked.
I propose (can do myself) that it checks to see if $this->value is an
array, and if so perform and in_array so that you can specify multiple
values. A better way would be to allow the coder to specify which key
to use in a sub array or class, much like JHtml::('select.option')
Quick two second fix (tested with Monday's nightly):
if (is_array( $this->value )) {
$checked = (in_array((string) $option->value, $this->value)) ? '
checked="checked"' : '';
} else {
$checked = ((string) $option->value == (string) $this->value) ? '
checked="checked"' : '';
}
Thanks
Chris
--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To post to this group, send an email to
joomla-...@googlegroups.com.
To unsubscribe from this group, send email to
joomla-dev-cm...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/joomla-dev-cms?hl=en-GB.