using set_select() inside php loop |
[eluser]Unknown[/eluser]
Hello, How to use set_select inside PHP loop, like example below: Code: <select name='rack_name'> Thank you
[eluser]LuckyFella73[/eluser]
Your example seems to be ok - did you try and got an error message?
[eluser]Ahaenor[/eluser]
Hello, seems like i'm having the same issue. My repopulation code is very close to azzzf's example, but i can't get repopulation of the select field. set_select() just returns an empty string in any case (field value is in the $_POST and thus in the $this->input->post()). I'd be thankful for some hint. EDIT: Found some threads on this issue. Most likely it's a validation class bug. To fix it and repopulate your select (and other) fields, you must set the validation rule explicitly: Code: $this->form_validation->set_rules('field_name', 'Field title/label', 'validation_rules (or leave it empty, if field do not need validation)'); Info is taken from this thread.
[eluser]Ahaenor[/eluser]
[quote author="Ahaenor" date="1274307656"]Hello, seems like i'm having the same issue. My repopulation code is very close to azzzf's example, but i can't get repopulation of the select field. set_select() just returns an empty string in any case (field value is in the $_POST and thus in the $this->input->post()). I'd be thankful for some hint. EDIT: Found some threads on this issue. Most likely it's a validation class bug. To fix it and repopulate your select (and other) fields, you must set the validation rule explicitly: Code: $this->form_validation->set_rules('field_name', 'Field title/label', 'validation_rules (or leave it empty, if field validation is not needed)'); Info is taken from this thread.[/quote]
[eluser]Unknown[/eluser]
Hello LuckyFella73 and Ahaenor, Thank you for your reply. As mentioned by Ahanor post above, adding validation rules seem fixed the problem. |
Welcome Guest, Not a member yet? Register Sign In |