0
votes

I'm having change password form in magento Account Information page.Here I want to validate password fields(password,confirm password,current password) while current password has value.Otherwise it should not validate.

In magento 1.5.1.0 really easy field validation is used to validate the forms.

I know addClassName add the validate like below

    $('current_password').addClassName('required-entry');
    $('password').addClassName('required-entry');
    $('confirmation').addClassName('required-entry');

removeClassName this one removes validation

$('current_password').removeClassName('required-entry');
$('password').removeClassName('required-entry');
$('confirmation').removeClassName('required-entry');

But how can i apply only while current_password has value.I'm not familiar with prototype.js functions .Kindly help me

1

1 Answers

1
votes

In that template file, you can put a check in PHP around the javascript to add or remove validation. For example,

<?php if ($customer->getCurrentPassword()): ?>
    $('something').doStuff(); //however you want the logic to work
<?php endif; ?>