John Davidson

php - Codeigniter set_value Limitation

0 comments
Message:


I have a form in Codeigniter with about 100 checkboxes. After validation, the set_value works fine for the first checkboxes, but not for the rest. Is there any limitation for the amount of set_values?


<label>
<?php
echo form_checkbox('indoor[]', '1', set_checkbox('indoor[]', 1)); ?>
Text 1
</label>
...
<label>
<?php
echo form_checkbox('indoor[]', '100', set_checkbox('indoor[]', 100)); ?>
Text 100
</label>

Bests,
Yanick



My Answer:
There is no specific limitation for the amount of set_value calls in Codeigniter. However, there may be other factors causing the issue you are experiencing with set_value not working for all checkboxes.

One possible reason could be that the names of the checkboxes are not being set correctly in the HTML form. Make sure that each checkbox has a unique name attribute in the form so that set_value can correctly populate the values after validation.

Another reason could be that the values are not being properly passed to the set_value function. Double-check that the values are being passed correctly to the set_value function for each checkbox.

If you are still facing issues, you may want to consider using an alternative method for populating the checkboxes after validation, such as manually setting the values in the controller or using JavaScript to populate the checkboxes based on the validation results.

Rate this post

5 of 5 based on 3955 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us