基础4:无法覆盖其正则表达式以验证密码

aag*_*wal 1 validation zurb-foundation

我想覆盖由foundation(zurb)提供的密码模式,但它没有识别我的覆盖正则表达式并根据默认表达式生成错误.默认情况下,基金会提供的密码验证"必须至少包含8个字符,包含1个大写字母,1个数字和1个特殊字符".为此,我使用了以下内容:

1)

<head>
<script>
$(document)
  .foundation()
  .foundation('abide', {
    patterns: {
      new: ^[a-zA-Z]\w{3,14}$,
       }
  });
 </script></head>
<body>
<form class="custom" data-abide>
<div class="row">
    <div class="large-12 columns">
        <label>Password <small>required</small></label>
            <input type="password" pattern="new" required >
                <small class="error" data-error-message="">validation error.</small>
    </div>
</div>

</form>
</body>
Run Code Online (Sandbox Code Playgroud)

2)

<form class="custom" data-abide="">
</form>
Run Code Online (Sandbox Code Playgroud)

3)输入标签中直接使用的模式:

<input type="password" pattern="^[a-zA-Z]\w{3,14}$" required >
Run Code Online (Sandbox Code Playgroud)

但所有这些都没有用.请建议我解决我的问题.

你可以在这里找到示例程序

Jac*_*han 11

在运行基础之前更新值:

<script>
Foundation.libs.abide.settings.patterns.password = /^\w{3,14}$/;
$(document).foundation();
</script>
Run Code Online (Sandbox Code Playgroud)