Javascript 使用commide进行表单验证 我使用基础CSS进行前端设计,如何使用LIN(表单验证器)?< /P> version : '5.3.3', settings : { live_validate : true, focus_on_invalid : true, error_labels: true, // labels with a for="inputId" will recieve an `error` class timeout : 1000, patterns : { alpha: /^[a-zA-Z]+$/, alpha_numeric : /^[a-zA-Z0-9]+$/, integer: /^[-+]?\d+$/, // modified here cvv : /^([0-9]){3,4}$/, \\ I have just copied the above line and renamed the pattern as "cv" cv : /^([0-9]){3,4}$/' \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work. `

Javascript 使用commide进行表单验证 我使用基础CSS进行前端设计,如何使用LIN(表单验证器)?< /P> version : '5.3.3', settings : { live_validate : true, focus_on_invalid : true, error_labels: true, // labels with a for="inputId" will recieve an `error` class timeout : 1000, patterns : { alpha: /^[a-zA-Z]+$/, alpha_numeric : /^[a-zA-Z0-9]+$/, integer: /^[-+]?\d+$/, // modified here cvv : /^([0-9]){3,4}$/, \\ I have just copied the above line and renamed the pattern as "cv" cv : /^([0-9]){3,4}$/' \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work. `,javascript,validation,zurb-foundation,abide,Javascript,Validation,Zurb Foundation,Abide,例如:。。如果我只需要允许10个字符作为现场电话号码 version : '5.3.3', settings : { live_validate : true, focus_on_invalid : true, error_labels: true, // labels with a for="inputId" will recieve an `error` class timeout : 1000, patterns : { alpha: /^[a-zA-Z]+$

例如:。。如果我只需要允许10个字符作为现场电话号码

version : '5.3.3',

settings : {
  live_validate : true,
  focus_on_invalid : true,
  error_labels: true, // labels with a for="inputId" will recieve an `error` class
  timeout : 1000,
  patterns : {
    alpha: /^[a-zA-Z]+$/,
    alpha_numeric : /^[a-zA-Z0-9]+$/,
    integer: /^[-+]?\d+$/,

    // modified here

    cvv : /^([0-9]){3,4}$/,   \\ I have just copied the above line and renamed the pattern as "cv"
    cv : /^([0-9]){3,4}$/'   \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work.

    `
如果我错了,请指正我,我是新手,使用基础和Web DEV.<
version : '5.3.3',

settings : {
  live_validate : true,
  focus_on_invalid : true,
  error_labels: true, // labels with a for="inputId" will recieve an `error` class
  timeout : 1000,
  patterns : {
    alpha: /^[a-zA-Z]+$/,
    alpha_numeric : /^[a-zA-Z0-9]+$/,
    integer: /^[-+]?\d+$/,

    // modified here

    cvv : /^([0-9]){3,4}$/,   \\ I have just copied the above line and renamed the pattern as "cv"
    cv : /^([0-9]){3,4}$/'   \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work.

    `
我已经试过了。。。这行不通

version : '5.3.3',

settings : {
  live_validate : true,
  focus_on_invalid : true,
  error_labels: true, // labels with a for="inputId" will recieve an `error` class
  timeout : 1000,
  patterns : {
    alpha: /^[a-zA-Z]+$/,
    alpha_numeric : /^[a-zA-Z0-9]+$/,
    integer: /^[-+]?\d+$/,

    // modified here

    cvv : /^([0-9]){3,4}$/,   \\ I have just copied the above line and renamed the pattern as "cv"
    cv : /^([0-9]){3,4}$/'   \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work.

    `

首先,我要看一下他们的文档(这里:)

version : '5.3.3',

settings : {
  live_validate : true,
  focus_on_invalid : true,
  error_labels: true, // labels with a for="inputId" will recieve an `error` class
  timeout : 1000,
  patterns : {
    alpha: /^[a-zA-Z]+$/,
    alpha_numeric : /^[a-zA-Z0-9]+$/,
    integer: /^[-+]?\d+$/,

    // modified here

    cvv : /^([0-9]){3,4}$/,   \\ I have just copied the above line and renamed the pattern as "cv"
    cv : /^([0-9]){3,4}$/'   \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work.

    `
在那里,您将学习如何添加自定义模式(因为您有一些自定义需求)

version : '5.3.3',

settings : {
  live_validate : true,
  focus_on_invalid : true,
  error_labels: true, // labels with a for="inputId" will recieve an `error` class
  timeout : 1000,
  patterns : {
    alpha: /^[a-zA-Z]+$/,
    alpha_numeric : /^[a-zA-Z0-9]+$/,
    integer: /^[-+]?\d+$/,

    // modified here

    cvv : /^([0-9]){3,4}$/,   \\ I have just copied the above line and renamed the pattern as "cv"
    cv : /^([0-9]){3,4}$/'   \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work.

    `
你必须定义一个新的模式,也许叫它phoneNumber

version : '5.3.3',

settings : {
  live_validate : true,
  focus_on_invalid : true,
  error_labels: true, // labels with a for="inputId" will recieve an `error` class
  timeout : 1000,
  patterns : {
    alpha: /^[a-zA-Z]+$/,
    alpha_numeric : /^[a-zA-Z0-9]+$/,
    integer: /^[-+]?\d+$/,

    // modified here

    cvv : /^([0-9]){3,4}$/,   \\ I have just copied the above line and renamed the pattern as "cv"
    cv : /^([0-9]){3,4}$/'   \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work.

    `
$(document)
  .foundation({
    abide : {
      patterns: {
        phoneNumber: ^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$ //this matches (111) 222-3333 | 1112223333 | 111-222-3333
      }
    }
  });
定义模式后,您可以继续使用它:

version : '5.3.3',

settings : {
  live_validate : true,
  focus_on_invalid : true,
  error_labels: true, // labels with a for="inputId" will recieve an `error` class
  timeout : 1000,
  patterns : {
    alpha: /^[a-zA-Z]+$/,
    alpha_numeric : /^[a-zA-Z0-9]+$/,
    integer: /^[-+]?\d+$/,

    // modified here

    cvv : /^([0-9]){3,4}$/,   \\ I have just copied the above line and renamed the pattern as "cv"
    cv : /^([0-9]){3,4}$/'   \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work.

    `
<form class="custom" data-abide>
  <label>Phone Number
    <input type="text" pattern="phoneNumber" required>
  </label>
</form>

电话号码

当需要RegExp时,这里有一个指向另一个有用站点的链接:-如果您想匹配不同的格式,请查看那里。

我添加了模式'abc://^([0-9]){5,6}$/`
version : '5.3.3',

settings : {
  live_validate : true,
  focus_on_invalid : true,
  error_labels: true, // labels with a for="inputId" will recieve an `error` class
  timeout : 1000,
  patterns : {
    alpha: /^[a-zA-Z]+$/,
    alpha_numeric : /^[a-zA-Z0-9]+$/,
    integer: /^[-+]?\d+$/,

    // modified here

    cvv : /^([0-9]){3,4}$/,   \\ I have just copied the above line and renamed the pattern as "cv"
    cv : /^([0-9]){3,4}$/'   \\the pattern cvv works but the same when I copy pasted and renamed to cv does not work.

    `