PageRenderTime 23ms CodeModel.GetById 17ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/public/javascripts/jQuery-validationEngine-2.6.1/tests/issue430.html

https://bitbucket.org/hamidrezas/melobit
HTML | 43 lines | 42 code | 1 blank | 0 comment | 0 complexity | a7867388ff221ae71d7448a23ae4b339 MD5 | raw file
Possible License(s): AGPL-1.0
 1<!DOCTYPE html>
 2<html>
 3  <head>
 4    <title>Issue #430: Do not validate empty fields that is not required.</title>
 5    <meta charset="UTF-8" />
 6    <link rel="stylesheet" type="text/css" href="../css/validationEngine.jquery.css" />
 7    <script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
 8    <script type="text/javascript" src="../js/languages/jquery.validationEngine-en.js"></script>
 9    <script type="text/javascript" src="../js/jquery.validationEngine.js"></script>
10    <script type="text/javascript">
11      $(document).ready(function() {
12        // Define a custom validation function.
13        $.validationEngineLanguage.allRules['test_value'] = {
14          "func": function(field, rules, i, options) {
15            return (field.val() == 'test');
16          },
17          "alertText": "* Value must be 'test'."
18        };
19
20        // Initiate the validation engine.
21        $('#form').validationEngine();
22      });
23    </script>
24  </head>
25  <body>
26    <h1>Issue #430: Do not validate empty fields that is not required.</h1>
27    <p>
28      See <a href="https://github.com/posabsolute/jQuery-Validation-Engine/issues/430">https://github.com/posabsolute/jQuery-Validation-Engine/issues/430</a>
29      for information.
30    </p>
31    <form id="form" action="/" method="POST">
32      <p>
33        <label for="test_case_1">Not required, but validate input if value is present.</label><br />
34        <input type="text" name="test_case_1" class="validate[custom[test_value]]" /><br />
35      </p>
36      <p>
37        <label for="test_case_2">Required, validate input.</label><br />
38        <input type="text" name="test_case_2" class="validate[required, custom[test_value]]" />
39      </p>
40      <input type="submit" value="Submit" />
41    </form>
42  </body>
43</html>