Welcome Guest, Not a member yet? Register   Sign In
How does a form validation know about the form?
#2

(This post was last modified: 06-12-2017, 10:59 AM by PaulD.)

The form validation, on run, looks for the names given in the rules you set for matching inputs in the S_POST array. Your form may or may not actually submit those inputs.

For instance you set rules:

PHP Code:
$this->form_validation->set_rules('name''User Name''required|min_length[3]); 
Described simply: when you run the form validation, it will look for an input value in $_POST['name'], if it exists (required) and is longer than 3 chars (min_length) then for that rule you get a TRUE return. If it does not validate you get an associated error message returned.

If the $_POST array contains more fields, they are not referred to unless you have set a rule.

It needs know nothing about your form, your view, or what you do with that data.

Hope that helps,

Paul.

I just binged and this was the first result - I hope it helps: http://www.jquery-az.com/php-post-an-ass...uery-ajax/
Reply


Messages In This Thread
RE: How does a form validation know about the form? - by PaulD - 06-12-2017, 10:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB