⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠

Confirm Password always not match with Password

password confirm password

  • Please log in to reply
1 reply to this topic

#1 lordlaw



  • Members
  • Pip
  • 2 posts

Posted 17 January 2016 - 04:36 AM

i had a membership form

with user creating new member with their new password.


so in the form will have Password and Confirm Password field.


in add form, they are working fine


but when it come to edit

Confirm password always not match with Password, although i had clearly input the correct for both fields.

if($crud->getState() == "edit") {
    $crud->field_type('Username', 'readonly');
    $crud->callback_edit_field('Password', function($value){
	return '<input type="password" maxlength="128" value="" name="Password" class="form-control" id="field-Password">';

if($crud->getState() == "insert_validation") {
    $crud->set_rules('Password', 'Password', 'required');
    $crud->set_rules("CPassword", 'Confirm Password', "trim|required|matches[Password]");
} else if($crud->getState() == "update_validation") {
    $crud->set_rules("CPassword", 'Confirm Password', "matches[Password]");

any advices ?



#2 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts

Posted 19 January 2016 - 10:55 PM



What here is happening - in crud - u trying to do a validation on a field that dose not exists ...

check your own code - you are generating the password field on the fly - only when it is in state - edit.

The same will not be available technically on next call when update_validation is happening.

Thats where i will recommend - u set a psuedo field of nPassword / cPassword .. 

callback before update ... check if the nPassword field is filled up with value or not..

if yes - append password field as index to the array ... and return the same (of course - add or not .. u have to unset nPassword / cPassword before returning to avoid any sort of errors)


Hope this fixes your requirement..


Happy GCing :)

Also tagged with one or more of these keywords: password, confirm password

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users