Hi All,
I have multiple check boxes in a form.I need them to be a mandatory, I enabled the required option but it only works for the first group check boxes.I went to code to look at it and I found that there is a common validate function were used in all the checkboxes like the below one,
The modified the code is below,
I have resolved this issue by modifying the class through code but I need it done by the wizard edit because when I edit something in the wizard edit the code will be rest by itself then I had to do that again through the code .
I have multiple check boxes in a form.I need them to be a mandatory, I enabled the required option but it only works for the first group check boxes.I went to code to look at it and I found that there is a common validate function were used in all the checkboxes like the below one,
<div class="ccms_form_element cfdiv_checkboxgroup" id="1_how_would_you_rate_the_quality_of_the_food__container_div">
<label for="input_checkbox_group_2" class="clsQuestion" >1. How would you rate the quality of the food?</label>
<input type="checkbox" name="input_checkbox_group_2[]" id="input_checkbox_group_2_poor" title="" value="poor" class="validate['group[1]']">
<label for="input_checkbox_group_2_poor">Poor</label>
<input type="checkbox" name="input_checkbox_group_2[]" id="input_checkbox_group_2_good" title="" value="good" class="validate['group[1]']">
<label for="input_checkbox_group_2_good">Good</label>
<input type="checkbox" name="input_checkbox_group_2[]" id="input_checkbox_group_2_excellent" title="" value="excellent" class="validate['group[1]']">
<label for="input_checkbox_group_2_excellent">Excellent</label>
<div class="clear"></div>
<div id="error-message-input_checkbox_group_2" ></div>
</div>
<div class="ccms_form_element cfdiv_checkboxgroup" id="2_please_rate_the_friendliness_of_the_staff__container_div">
<label for="input_checkbox_group_3" class="clsQuestion" >2. Please rate the friendliness of the staff.</label>
<input type="checkbox" name="input_checkbox_group_3[]" id="input_checkbox_group_3_poor" title="" value="poor" class="validate['group[1]']">
<label for="input_checkbox_group_3_poor">Poor</label>
<input type="checkbox" name="input_checkbox_group_3[]" id="input_checkbox_group_3_good" title="" value="good" class="validate['group[1]']">
<label for="input_checkbox_group_3_good">Good</label>
<input type="checkbox" name="input_checkbox_group_3[]" id="input_checkbox_group_3_excellent" title="" value="excellent" class="validate['group[1]']">
<label for="input_checkbox_group_3_excellent">Excellent</label>
<div class="clear"></div>
<div id="error-message-input_checkbox_group_3"></div>
</div>
The modified the code is below,
<div class="ccms_form_element cfdiv_checkboxgroup" id="1_how_would_you_rate_the_quality_of_the_food__container_div">
<label for="input_checkbox_group_2" class="clsQuestion" >1. How would you rate the quality of the food?</label>
<input type="checkbox" name="input_checkbox_group_2[]" id="input_checkbox_group_2_poor" title="" value="poor" class="validate['group[1]']">
<label for="input_checkbox_group_2_poor">Poor</label>
<input type="checkbox" name="input_checkbox_group_2[]" id="input_checkbox_group_2_good" title="" value="good" class="validate['group[1]']">
<label for="input_checkbox_group_2_good">Good</label>
<input type="checkbox" name="input_checkbox_group_2[]" id="input_checkbox_group_2_excellent" title="" value="excellent" class="validate['group[1]']">
<label for="input_checkbox_group_2_excellent">Excellent</label>
<div class="clear"></div>
<div id="error-message-input_checkbox_group_2" ></div>
</div>
<div class="ccms_form_element cfdiv_checkboxgroup" id="2_please_rate_the_friendliness_of_the_staff__container_div">
<label for="input_checkbox_group_3" class="clsQuestion" >2. Please rate the friendliness of the staff.</label>
<input type="checkbox" name="input_checkbox_group_3[]" id="input_checkbox_group_3_poor" title="" value="poor" class="validate['group[2]']">
<label for="input_checkbox_group_3_poor">Poor</label>
<input type="checkbox" name="input_checkbox_group_3[]" id="input_checkbox_group_3_good" title="" value="good" class="validate['group[2]']">
<label for="input_checkbox_group_3_good">Good</label>
<input type="checkbox" name="input_checkbox_group_3[]" id="input_checkbox_group_3_excellent" title="" value="excellent" class="validate['group[2]']">
<label for="input_checkbox_group_3_excellent">Excellent</label>
<div class="clear"></div>
<div id="error-message-input_checkbox_group_3"></div>
</div>
I have resolved this issue by modifying the class through code but I need it done by the wizard edit because when I edit something in the wizard edit the code will be rest by itself then I had to do that again through the code .
Hi tsrlinkan,
This is a bug :-(
The fix is to open administrator/components/com_chronoforms/form_elements/input_checkbox_group.ctp and edit this line (around line 53) to replace 'group[1]' with 'group[{n}]':
Bob
This is a bug :-(
The fix is to open administrator/components/com_chronoforms/form_elements/input_checkbox_group.ctp and edit this line (around line 53) to replace 'group[1]' with 'group[{n}]':
<?php echo $HtmlHelper->input('input_checkbox_group_{n}_validations_config', array('type' => 'checkbox', 'label' => '1 Required', 'class' => 'small_input', 'value' => 'group[{n}]', 'rule' => "split", 'splitter' => ",")); ?>
Bob
This topic is locked and no more replies can be posted.