Repopulating checkboxes in Codeigniter after Unsuccessful Form Validation

前端 未结 9 768
梦毁少年i
梦毁少年i 2021-02-04 16:18

I have a problem repopulating a set of checkboxes after an unsuccessful form validation returns the user back to the same form. Dropdown menus and text inputs could be repopulat

9条回答
  •  死守一世寂寞
    2021-02-04 16:30

    In order for set_checkbox to work properly, an actual validation rule needs to be used on that element. I ran into this problem and could not get the value to show on a resubmit until I included:

    $this->form_validation->set_rules('checkbox_name', 'checkbox_title', 'trim');
    

    Then, everything worked perfect.

提交回复
热议问题