Hi,
In Designer mode, I have a checkbox group with options
fn_1=description_1
fn_2=description_2
....
fn_n=description_n
and selected values fn_1,fn_2 etc
When the form is displayed in Designer mode with only one entry in selected values (e.g. fn_1) it correctly displays the selected checkbox.
If I add a second comma separated value (e.g. fn_1,fn_2), then nothing is shown as selected. (I have also tried space and semicolon).
Could anyone let me know how this should be done as I can't find this documentsed anywhere (or I have missed it!)
Thanks
Pete
In Designer mode, I have a checkbox group with options
fn_1=description_1
fn_2=description_2
....
fn_n=description_n
and selected values fn_1,fn_2 etc
When the form is displayed in Designer mode with only one entry in selected values (e.g. fn_1) it correctly displays the selected checkbox.
If I add a second comma separated value (e.g. fn_1,fn_2), then nothing is shown as selected. (I have also tried space and semicolon).
Could anyone let me know how this should be done as I can't find this documentsed anywhere (or I have missed it!)
Thanks
Pete
Hi Pete,
I don't think that you can set a multiple selection that way :-(
I've never seen the question asked before but I would try to solve it by adding code like this to a Custom Code action in the form On Load event:
Bob
I don't think that you can set a multiple selection that way :-(
I've never seen the question asked before but I would try to solve it by adding code like this to a Custom Code action in the form On Load event:
<?php
if ( !isset($form->data['checkbox_group_name']) || !is_array($form->data['checkbox_group_name']) ) {
$form->data['checkbox_group_name'] = array('fn-1', 'fn_2');
}
?>
Bob
Hi Bob
I have added the following to a custom code and not sure whether it should go before or after the render.
Either before or after, it gives an error on form load of...
Parse error: syntax error, unexpected '||' (T_BOOLEAN_OR), expecting ',' or ')' in /home/superpan/public_html/...../custom_code.php(20) : eval()'d code on line 2
[attachment=0]one.png[/attachment]
[attachment=1]two.png[/attachment]
[attachment=2]three.png[/attachment]
[attachment=3]four.png[/attachment]
Thanks...
Pete
I have added the following to a custom code and not sure whether it should go before or after the render.
<?php
if ( !isset($form->data['checkbox'] ||
!is_array($form->data['checkbox']) ) {
$form->data['checkbox'] = array('advice_socialisation', 'advice_socialisation_check');
}
?>
Either before or after, it gives an error on form load of...
Parse error: syntax error, unexpected '||' (T_BOOLEAN_OR), expecting ',' or ')' in /home/superpan/public_html/...../custom_code.php(20) : eval()'d code on line 2
[attachment=0]one.png[/attachment]
[attachment=1]two.png[/attachment]
[attachment=2]three.png[/attachment]
[attachment=3]four.png[/attachment]
Thanks...
Pete
Hi Pete,
Sorry, I missed a bracket ) in line 2 - fixed now.
It would go in a Custom Code action before the HTML (Render Form) action.
Bob
Sorry, I missed a bracket ) in line 2 - fixed now.
It would go in a Custom Code action before the HTML (Render Form) action.
Bob
This topic is locked and no more replies can be posted.