validation problem |
[eluser]-spy-[/eluser]
i was testing this code Code: <html> but error occured Code: Username what supposed to be the problem?
[eluser]Sawariya[/eluser]
Check in your validation function ... $field['username'] = "Username";
[eluser]xwero[/eluser]
The validation values are only automatically set after the validation of the form field. If you want to add default values you have to make a loop where you add the values, for instance Code: $fields('username'=>'me');
[eluser]Sawariya[/eluser]
That ok... here ur property name is not matching with ur validating field name
[eluser]Peter Ivanov[/eluser]
Hello is there a way that i can use the validation class to validate variables, is something like this possible Code: $var = 'is_this_email';
[eluser]tonanbarbarian[/eluser]
yes you could do something like that Most of the rules that you can set such as required, matches, min_length, max_length, exact_length, valid_email, valid_ip, alpha, aplha_numeric, alpha_dash and numeric are just methods of the validation class that return a boolean value so if you wanted to test if an email address was valid for example you could Code: if ($this->validation->valid_email('[email protected]'))...
[eluser]Chris Newton[/eluser]
You could also set the validation rules to check a callback function before the form will validate. Of course, this assumes you're pulling data from a form, and not just using the validation class by itself. $rules['var'] = "required|min_length[5]|callback_variable_check"; Refer to the 'setting validation rules' of the documentation; http://ellislab.com/codeigniter/user-gui...ation.html |
Welcome Guest, Not a member yet? Register Sign In |