CodeIgniter – radio and checkbox – value=”0″


In a work that i’m working on, some values of checkboxes and radios have values = 0.
CodeIgniter don’t like them.

Found the solution for it here.

FYI – I fixed this bug. I dont know how to do pull requests – but you need to change Form_validation line 825:

from: if (($field == ” OR $value == ”) OR ($field != $value))
to: if (($field === ” OR $value === ”) OR ($field != $value))

Otherwise it doesnt evaluate the 0 correctly.

You probably also need to do it to lines 781 and 869 (set_select() and set_checkbox() )- but I havent tested it

By TheShiftExchange

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.