Skip to content

Validating via JS without markup on HTML file #221

Closed
@brunogdesign

Description

@brunogdesign

HI!

Is there a way to configure the validations without adding stuff to the html file, only via JS?
Something like searching the dom for a certain ID or Name and then associate the needed validators and messages....

Something like (this is from other validation plugin):

fields: {
            username: {
                validators: {
                    notEmpty: {
                        message: 'The username is required'
                    },
                    stringLength: {
                        min: 6,
                        max: 30,
                        message: 'The username must be more than 6 and less than 30 characters long'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9_]+$/,
                        message: 'The username can only consist of alphabetical, number and underscore'
                    }
                }
            },
            password: {
                validators: {
                    notEmpty: {
                        message: 'The password is required'
                    }
                }
            }
        }

Thanks ;)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions