Welcome Guest, Not a member yet? Register   Sign In
Form validation rule question
#3

[eluser]mrh[/eluser]
[quote author="CroNiX" date="1343263712"]Yes, rules are processed left to right.
Yes, rules like "trim", otherwise known as a "prepping function" do alter the values as they manipulate the data and return it. If a function returns a value other than a boolean TRUE/FALSE, that value will be the new value and the rule is assumed to "pass". If you return a TRUE, the rule passes, return FALSE and it doesn't.

Please read the [urlhttp://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#preppingdata]Prepping Data section[/url] of the Form Validation library for more info.
Quote:Note: You will generally want to use the prepping functions after the validation rules so if there is an error, the original data will be shown in the form.
[/quote]

Thanks for that! What is not clear in the prepping section which I did read is when the form validation calls a prepping function like trim, is where is the result of trim stored. This is not clear form the prepping function section. If I read your reply correctly and the prepping section it sounds like a rule like I specified "trim" effectively does:

$_POST['field'] = trim( $_POST['field']

So that if I later get data out of $_POST['field'] that it has been trimmed right?


Messages In This Thread
Form validation rule question - by El Forum - 07-25-2012, 04:54 PM
Form validation rule question - by El Forum - 07-25-2012, 05:48 PM
Form validation rule question - by El Forum - 07-25-2012, 06:41 PM
Form validation rule question - by El Forum - 07-25-2012, 07:00 PM
Form validation rule question - by El Forum - 07-25-2012, 07:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB