Makes the element require a given step.

 

normalizer

Prepares/transforms the elements value for validation.

Transform the value of an element and the result for validation instead of the initial value.

The normalizer can be defined global to all elements or local to only one element.

  • With that said, the local normalizer will only run for the element for which it was defined.
  • The global normalizer will run for all validated elements.

This normalizer can be then overrided for each element, as needed, by attaching one to it.

This way only the local one will run for that element, and the global one will run for others.

Note that this method:

  • Doesn't change the elements' value, it only changes the value used for validation.
  • Gets the value passed as argument, and "this" within it references the corresponding DOMElement.
  • Needs to return a String value, otherwise it will throw a TypeError exception.

require_from_group method

Ensures a given number of fields in a group are complete.

In the options passed to the rule, supply the minimum number of fields
within the group that must be complete and a selector to define the
group.

Then apply this rule to all the fields within the group.
The form then cannot be submitted until at least the minimum number have
been completed.

Part of the additional-methods.js file

url method

Makes the element require a valid url

Return true, if the value is a valid url.

Works with text inputs.

required method

Makes the element required.

  • required()

  • required( dependency-expression )

    • dependency-expression
      Type: String
      An expression (String) that is evaluated in the context of the element's
      form, making the field required only if the expression returns more
      than one element.
  • required( dependency-callback )

    • dependency-callback
      Type: Function()
      The function is executed with the element as it's only argument: If it returns true, the element is required. 
      • Return false, if the element is empty (text input) or unchecked (radio/checkbox) or if nothing is selected (select).
      • Works with text inputs, selects, checkboxes and radio buttons.
      • To force a user to select an option from a select box, provide an empty
        option element like <option value="">Choose…</option>
      • Note that white spaces are considered valid.

remote method

  • remote( options )

    • Requests a resource to check the element for validity.
    • options
      Type: Object
      For the URL of the resource to request for serverside validation (String) or options to fully customize the request, see jQuery.ajax for details.
      • These options deep-extend the defaults (dataType:"json", data:{nameOfTheElement:valueOfTheElement}). Any options you provide will override the defaults.
    • The serverside resource is called via jQuery.ajax (XMLHttpRequest) and
      gets a key/value pair corresponding to the name of the validated element
      and its value as a GET parameter.

      • The serverside response must be a
        JSON string that must be "true" for valid elements, and can be "false", undefined, or null for invalid elements, using the default error message.
      • If the serverside response is a string, eg. "That name is already taken, try peter123 instead", this string will be displayed as a custom error message in place of the default.
      • For more examples, take a look the marketo demo and the milk demo.

rangelength method

Return false if the element is:

  • some kind of text input and its length is too short or too long
  • a set of checkboxes that doesn't have enough, or has too many boxes checked
  • a select that doesn't have enough, or has too many options selected

Works with text inputs, selects and checkboxes.

range method

phoneUS method

Validate for valid US phone number.

Works with text inputs.

Part of the additional-methods.js file

number method

Makes the element require a decimal number.

Returns true if the value contains a valid decimal number.

Works with text inputs.

  • value
    Type: Number
    Step value required 

最新文章

  1. PHP实现实现数字补零格式化
  2. java报表工具FineReport常用函数的用法总结(文本和日期函数)
  3. 接口 Post
  4. 使用命令行备份指定文件夹并保留最新N份
  5. QA:java.lang.RuntimeException:java.io.FileNotFoundException:Resource nexus-maven-repository-index.properties does not exist.
  6. HTML5每日一练之input新增加的5种其他类型1种标签应用
  7. hdu 3778
  8. SQL 关于有单引号数据更新的问题
  9. Sql Server索引(转载)
  10. 使用Mina框架开发 QQ Android 客户端
  11. Android JNI入门第三篇——jni头文件分析
  12. .net EF中从数据添加表或视图时无法添加的问题
  13. 每天一个Linux命令(05)--rm命令
  14. synchronized的4种用法
  15. Unity3D Layer要点
  16. 学习EtherCAT的感想
  17. 配置zsh
  18. iOS 问答时间
  19. java黑魔法-反射机制-01
  20. angularjs图片上传和预览 base64

热门文章

  1. mybatis06--动态sql
  2. MSSQL:查看所有触发器信息的命令
  3. Linux命令更新系统时间,更新所有文件的时间(转)
  4. 【转】Windows下Python快速解决error: Unable to find vcvarsall.bat
  5. fiddler的一些记录
  6. ELK基础原理
  7. MySQL Backup myloader
  8. 与数论的厮守02:整数的因子分解—Pollard_Rho
  9. nuxtjs中修改head及vuex的使用
  10. 第二章 函数和window对象