Skip to content

required error #271

Closed
Closed
@Losty

Description

@Losty

I found an mistake, then i give an expression or callback for required attribute, other methods forget this param and work incorrect.

For example:
MyField {
required: "#Tmp:checked",
min: 10
}

then element #Tmp is not checked, means that value of MyField can be less then 10, how i understand, but it give an error.

i fixed it like this:

depend: function (param, element) {
    this.dependParam = param || this.dependParam;
    return this.dependTypes[typeof this.dependParam]
    ? this.dependTypes[typeof this.dependParam](this.dependParam, element)
    : true;
},

dependParam: undefined,

dependTypes: {
    "boolean": function (param, element) {
        return param;
    },
    "string": function (param, element) {
        return !!$(param, element.form).length;
    },
    "function": function (param, element) {
        return param(element);
    }
},

optional: function (element) {
    var required = $.validator.methods.required.call(this, $.trim(element.value), element, this.dependParam);

    return !required || required == "dependency-mismatch";
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy