Welcome Guest, Not a member yet? Register   Sign In
[solved] form_validation: second %s field in error message shows field id, not field label
#1

[eluser]Yednotek[/eluser]
When form validation involves 2 fields (like matches['passconf'] in the userguide example) then the 2nd field reference in the error message contains the formfield id instead of the label.

Example:
Code:
$rules_config=array(
array(
  'field'=>"user_password",
  'label'=>"Wachtwoord",
  'rules'=>"required|min_length[6]|max_length[16]|md5|matches['user_password2']"
),
array(
  'field'=>"user_password2",
  'label'=>"Wachtwoord check",
  'rules'=>"required|md5"
)
);    

$this->form_validation->set_message('matches',"Fields '%s' and '%s' don't match.");
Produces the error message:

Fields 'Wachtwoord' and 'user_password2' don't match.

Where expected behaviour would be:

Fields 'Wachtwoord' and 'Wachtwoord check' don't match.
#2

[eluser]Yednotek[/eluser]
Apologies this is not a bug, I should have left out the single quotes in matches['user_password2'], so matches[user_password2] instead.




Theme © iAndrew 2016 - Forum software by © MyBB