Welcome Guest, Not a member yet? Register   Sign In
Form Validation of array variables and form_error() and set_value()
#1

[eluser]Eric Cope[/eluser]
This is more of information post, so others can benefit from my toils...

Ok, I was able to dig down to the root cause of this error.
If I submit a POST array like this:
Code:
<input name="var1[]" value="something" />
<input name="var1[]" value="" />

and apply the following form validation rules:
Code:
trim|max_length[255]|alpha_numeric

The second value in the array will fail validation even though its not required as defined in the rule list.

Additionally, form_error() only stores a single error message, which prevents the user from properly identifying which index in the array is erroneous.

Finally, set_value() returns a single value, requiring me to use a while loop to extract all of the values. The forums indicate they may return an array. Can anyone confirm this is for CI2.x?


Messages In This Thread
Form Validation of array variables and form_error() and set_value() - by El Forum - 03-23-2011, 01:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB