Welcome Guest, Not a member yet? Register   Sign In
form validation + array + empty input
#1

[eluser]Steven_W[/eluser]
I've tried searching the forums & user guide but haven't found anything, excuse me if this was already answered.

AFAIK, normally if an input isnt set to required the rest of the rules are ignore if the input is empty and the input will return true.

Code:
echo form_input('last_name', set_value('last_name')) ## Input

Array('field' => 'last_name', 'label' => 'Last Name','rules' => 'alpha|max_length[16]') ## Rules

However if I use an array and the input is empty, that input will return false.

Code:
echo form_input('fields[last_name]', set_value('fields[last_name]')) ## Input

Array('field' => 'fields[last_name]', 'label' => 'Last Name','rules' => 'alpha|max_length[16]') ## Rules


other than not using arrays, is there a way around this?




Theme © iAndrew 2016 - Forum software by © MyBB