Re-populate checkbox if it fails in validation in an edit form in Codeigniter

前端 未结 5 395
谎友^
谎友^ 2021-01-16 18:13

I works on the an data-edit form in codeigintier. And the problem is about re-populate checkbox

It works if it is an add form (that means I need not concern about th

5条回答
  •  情深已故
    2021-01-16 18:53

    Can give one suggestion?? 1. Hide all the checked value of checkbox in input box when you are directed towards edit page.

    1. If checked box is checked in edit page, edit the value of hidden input field of textbox value.

    2. Submit it, when validation failed, checked or repopulate the checkbox value according to hidden field value. send checkbox value of checked box field through array from controller to edit page view like this. e.g $data['repopulate_checks'] = $this->input->post('array name of checkboxs'); In view : getit like this $catch_checkbox = $repopulate_checks; You can directly get through $repopulate_checks also. Hope this help you.

提交回复
热议问题