![]() |
checkbox array - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: checkbox array (/showthread.php?tid=2938) |
checkbox array - El Forum - 08-31-2007 [eluser]DIG[/eluser] Forgive me for my very bad English. I have read many of the forum on the arrays and checkbox, but bash can not solve a simple task. In my view: Code: <input name="test[1]" type="checkbox" value="1"> In my controller: Code: $rules['test'] = "callback_"; where I am wrong? or I am hopelessly stupid? ![]() Thanks. checkbox array - El Forum - 08-31-2007 [eluser]alpar[/eluser] Code: $rules['test'] = "callback_"; should be Code: $rules['test'] = "callback_test_check"; checkbox array - El Forum - 08-31-2007 [eluser]DIG[/eluser] Thanks for the quick response. Really in my code Code: $rules['test'] = "callback_test_check"; checkbox array - El Forum - 08-31-2007 [eluser]alpar[/eluser] try using only test[] in the field name, it might not get merged to an array... like so: Code: <input name="test[]" type="checkbox" value="1"> checkbox array - El Forum - 08-31-2007 [eluser]DIG[/eluser] Variations Code: <input name="test[]" type="checkbox" value="1"> Code: <input name="test" type="checkbox" value="1"> Code: <input name="test[1]" type="checkbox" value="1"> I wrote testing code. This controller: Code: <?php Code: <html> This is not working. This should be easy, but it is not working. :/ checkbox array - El Forum - 08-31-2007 [eluser]alpar[/eluser] try adding the callback function as a method of the controller. checkbox array - El Forum - 08-31-2007 [eluser]Unknown[/eluser] I started doing something similar today and ran into a problem, To get the validation library to see the fields do this: Code: $this->load->library('validation'); The only problem now is even if there is a value in the field, it gets ignored and the set message does not work either... Also, the set_fields and set_message is not required checkbox array - El Forum - 08-31-2007 [eluser]alpar[/eluser] there is some related bug with that, if i recall correctly, make a search on it checkbox array - El Forum - 08-31-2007 [eluser]DIG[/eluser] alpar, thanks for the help. I rewrite test controller: Code: <?php I am at a loss. checkbox array - El Forum - 09-01-2007 [eluser]alpar[/eluser] just got an idea... don't use a callback...use 'required' that comes with the framework...i think it works exactly as you would like it here, and also note, there is an 'isset' error in the language files that gets triggered when the field isn't set (like an unchecked check box), so you could just change the message for isset.... --- Somebody correct me if I'm wrong... I'm kind of busy and don't have the time to test what i am saying, nor run your code sry |