PageSourceSearch

https://www.texashealth.org/sitecore%20modules/Web/ExperienceForms/scripts/form.validate.js

js texashealth.org collected 2026-09-24 09:00:28 UTC 4,958 bytes, 126 lines download raw bytes

1(function($) {
2    var adapters = $.validator.unobtrusive.adapters;
3    adapters.fxbAddNumberVal = function (adapterName, attribute, ruleName) {
4        attribute = attribute || "val";
5        ruleName = ruleName || adapterName;
6        this.add(adapterName, [attribute], function(options) {
7                var attrVal = options.params[attribute];
8                if ((attrVal || attrVal === 0) && !isNaN(attrVal)) {
9                    options.rules[ruleName] = Number(attrVal);
10                }
11                if (options.message) {
12                    options.messages[ruleName] = options.message;
13                }
14            });
15    };
16
17    adapters.fxbAddMinMax = function(adapterName, minRuleName, maxRuleName, minAttribute, maxAttribute) {
18        minAttribute = minAttribute || "min";
19        maxAttribute = maxAttribute || "max";
20        this.add(adapterName, [minAttribute, maxAttribute], function(options) {
21                if (options.params[minAttribute] && options.params[maxAttribute]) {
22                    if (!options.rules.hasOwnProperty(minRuleName)) {
23                        if (options.message) {
24                            options.messages[minRuleName] = options.message;
25                        }
26                    }
27                    if (!options.rules.hasOwnProperty(maxRuleName)) {
28                        if (options.message) {
29                            options.messages[maxRuleName] = options.message;
30                        }
31                    }
32                }
33            });
34    };
35
36    adapters.addBool("ischecked", "required");
37
38    $.validator.addMethod(
39        "daterange",
40        function(value, element, params) {
41            return this.optional(element) || (value >= params.min && value <= params.max);
42        });
43
44    adapters.add(
45        "daterange",
46        ["min", "max"],
47        function(options) {
48            var params = {
49                min: options.params.min,
50                max: options.params.max
51            };
52            options.rules["daterange"] = params;
53            options.messages["daterange"] = options.message;
54        });
55
56    adapters.addSingleVal("filesize", "max");
57    $.validator.addMethod(
58        "filesize",
59        function (value, element, max) {
60            if (!this.optional(element)) {
61                for (var i = 0; i < element.files.length; i++) {
62                    if (element.files[i].size > max) {
63                        return false;
64                    }
65                }
66            }
67            return true;
68        });
69
70    adapters.addSingleVal("filecount", "max");
71    $.validator.addMethod(
72        "filecount",
73        function (value, element, max) {
74            if (!this.optional(element)) {
75                    if (element.files.length > max) {
76                        return false;
77                    }
78            }
79            return true;
80        });
81
82    adapters.addSingleVal("filetype", "allowedcontenttypes");
83    $.validator.addMethod(
84        "filetype",
85        function (value, element, allowedContentTypes) {
86            if (!this.optional(element)) {
87                var allowedContentTypesArray = allowedContentTypes.split(",").filter(function (s) {
88                    // Remove empty entries
89                    return s !== "";
90                });
91                if (allowedContentTypesArray.length) {
92                    for (var i = 0; i < element.files.length; i++) {
93                        var file = element.files[i];
94                        var isValid = false;
95                        for (var j = 0; j < allowedContentTypesArray.length; j++) {
96                            var allowedContentType = allowedContentTypesArray[j];
97                            if (allowedContentType.indexOf("/") !== -1) {
98                                // MIME type comparison if there is a slash "/"
99                                isValid = allowedContentType.toLowerCase() === file.type.toLowerCase();
100                            } else {
101                                // File extension comparison
102                                isValid = allowedContentType.toLowerCase() === "." + file.name.split(".").pop().toLowerCase();
103                            }
104
105                            if (isValid) {
106                                break;
107                            }
108                        }
109
110                        if (!isValid) {
111                            return false;
112                        }
113                    }
114                }
115            }
116            return true;
117        });
118
119    adapters.fxbAddNumberVal("min");
120    adapters.fxbAddNumberVal("max");
121    adapters.fxbAddNumberVal("step");
122
123    adapters.fxbAddMinMax("range", "min", "max");
124    adapters.fxbAddMinMax("length", "minlength", "maxlength");
125    adapters.fxbAddMinMax("daterange", "min", "max");
126})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.