I created two custom password fields, the confirm field should check if the value is the same as .create-password-field. I saw that Magento 2 uses equalTo but I can't get that to work in a uiComponent template.
I copied password.html and editted it.
The template i use for the create field:
password-overwrite.html
<input class="input-text create-password-field" type="password" data-bind="
value: value,
valueUpdate: 'keyup',
hasFocus: focused,
css: {focused: value() != '' && value() != ' '},
event: {
keyup: validationSuccess
},
attr: {
name: inputName,
placeholder: placeholder,
'aria-describedby': getDescriptionId(),
'aria-required': required,
'aria-invalid': error() ? true : 'false',
id: uid,
disabled: disabled
}"/>
password-overwrite-confirm-password.html
<input class="input-text" type="password" data-bind="
value: value,
valueUpdate: 'keyup',
hasFocus: focused,
css: {focused: value() != '' && value() != ' '},
event: {
keyup: validatePassword
},
attr: {
name: inputName,
placeholder: placeholder,
'aria-describedby': getDescriptionId(),
'aria-required': required,
'aria-invalid': error() ? true : 'false',
id: uid,
disabled: disabled
}" data-validate="{equalTo:'.create-password-field'} />
But that doesn't actually do anything for me? Or does it have to do with the fact that I don't have the field required. Since they are activated by a checkbox i'm not able to set them as required because otherwise they will still be required even if it's unchecked.
Thanks in advance!