Skip to content

Proposition : make data-name for checking password configurable #112

Closed
@simonvart

Description

@simonvart

I was working on a form where I couldn't change the name of the field, so I changed manually the security.dev.js file to fit my needs.

I think I could be easy and convienient to be able to target custom rule to make password/password confirmation manageable via plugin options.

In my case, I used data-attr to match :

$.formUtils.addValidator({
        name : 'confirmation',
        validatorFunction : function(value, $el, config, language, $form) {
            var conf = '',
                confInputName = $el.attr('data-name') + '_confirmation',
                confInput = $form.find('input[data-name="' +confInputName+ '"]').eq(0);
            if (confInput) {
                conf = confInput.val();
            } else {
                console.warn('Could not find an input with name "'+confInputName+'"');
            }

            return value === conf;
        },
        errorMessage : '',
        errorMessageKey: 'notConfirmed'
    });

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions