Skip to content

Append validations to existing validation #71

@markvantilburg

Description

@markvantilburg

E.g. in the example file there it checks if the required field is set.

Taking this example file, how would the require for :requiredInput2 be added to the list of validations when validity is already configured. Would it be possible to add an 'add' command to allow adding of extra validations?

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset=utf-8>
        <title>A simple HTML5 page layout</title>
        <link rel="stylesheet" href="jquery.validity.css" />
    </head>
    <body>
        <form action="">
            <frameset>
                <legend>The form</legend>

                <label for="requiredInput">This input is required.</label>
                <input type="text" id="requiredInput" />

                <input type="text" id="requiredInput2" />

                <input type="submit" />
            </frameset>
        </form>

        <script src="jquery-1.10.2.min.js"></script>
        <script src="jquery.validity.js"></script>
        <script>
            $("form").validity(function() {
                $("#requiredInput").require();
            });

            $("#requiredInput2").require();
        </script>
    </body>   
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions