Welcome Guest, Not a member yet? Register   Sign In
a form validation issue
#9

(This post was last modified: 08-13-2016, 01:42 AM by shadowpaw.)

Code:
$this->form_validation->set_message('required', "%s required");
$this->form_validation->set_rules('pass','password','required|min_length[8]|callback_access');

Thanks, Paul.
It doesn't work together means:
I thought the required rule would run first, then min_length rule, then callback function.

First, if password input text is empty(didn't type anything), then I press the submit button, I thought it would show 'password required'. But it didn't , it show the callback message "account or password was incorrect".
Second, if I type something in the password input text, but the length was under 8, then it would show "The password field must be at least 8 characters in length.". But it show the callback message "account or password was incorrect". Huh


In CI 3.0.6 (Error messages worked well.)
Input blank: shows the message 'password required'.
Input short: shows the message 'The password field must be at least 8 characters in length.'
Input wrong: shows the message 'account or password was incorrect'.
Input correct: passed.

In CI 3.1.0
Input blank: shows the message 'account or password was incorrect'. (ignore required rule)
Input short: shows the message 'account or password was incorrect'. (ignore min_length rule)
Input wrong: shows the message 'account or password was incorrect'. (correct)
Input correct: passed.(correct)

Why were they directly jump to the callback function , but ignore required and min_length rules. These are my issue.
Should I separate rules and callback function into a different text rule, such as the code bellow?
I mean, Couldn't they set together?

Code:
$this->form_validation->set_message('required', "%s required");
$this->form_validation->set_rules('acc','account','callback_login_access');
$this->form_validation->set_rules('pass','password','required|min_length[8]');


By the way, I'll use password_hash(). Thank you so much. Smile
Reply


Messages In This Thread
a form validation issue - by shadowpaw - 08-08-2016, 02:16 AM
RE: a form validation issue - by PaulD - 08-08-2016, 08:55 AM
RE: a form validation issue - by shadowpaw - 08-09-2016, 12:42 AM
RE: a form validation issue - by PaulD - 08-09-2016, 04:06 AM
RE: a form validation issue - by shadowpaw - 08-09-2016, 11:41 PM
RE: a form validation issue - by InsiteFX - 08-09-2016, 10:04 AM
RE: a form validation issue - by shadowpaw - 08-09-2016, 11:40 PM
RE: a form validation issue - by PaulD - 08-10-2016, 09:27 AM
RE: a form validation issue - by shadowpaw - 08-13-2016, 01:41 AM
RE: a form validation issue - by PaulD - 08-13-2016, 09:07 AM
RE: a form validation issue - by PaulD - 08-13-2016, 09:17 AM
RE: a form validation issue - by PaulD - 08-13-2016, 09:27 AM
RE: a form validation issue - by pgilgunn - 02-15-2017, 01:52 PM
RE: a form validation issue - by Narf - 02-15-2017, 03:30 PM
RE: a form validation issue - by pgilgunn - 02-16-2017, 03:01 AM
RE: a form validation issue - by Mr Lister - 04-08-2017, 05:41 AM
RE: a form validation issue - by shadowpaw - 05-10-2017, 03:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB