PageRenderTime 1ms CodeModel.GetById 19ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/hamidrezas/melobit
HTML | 40 lines | 33 code | 6 blank | 1 comment | 0 complexity | 9d5d610112966fdb6dc21a57bdb40801 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
13      $("#f").submit(function (event) {
14        event.preventDefault();
15        return false;
16      });
17
18      $("#f").validationEngine({
19
20            customFunctions : {
21                v : function(field, rules, i, options) {
22                    if ($("#f").length === 0) {
23                        return options.allrules.required.alertText;
24                    }
25                }
26            }
27
28      });
29
30
31      });
32    </script>
33  </head>
34  <body>
35    <form id="f" style="margin:100px;">
36      <!-- Note that the select has no 'options', and we want a custom function to validate it -->
37      <select id="s" class="validate[funcCall[v]]"></select>
38      <input id="i" type="submit"></input>
39    </form>
40</html>