|
101 | 101 | * |
102 | 102 | * @return true if the form validates, false if it fails |
103 | 103 | */ |
104 | | - validate: function() { |
| 104 | + validate: function(userOptions) { |
105 | 105 | var element = $(this); |
106 | 106 | var valid = null; |
| 107 | + var options; |
107 | 108 |
|
108 | 109 | if (element.is("form") || element.hasClass("validationEngineContainer")) { |
109 | 110 | if (element.hasClass('validating')) { |
|
112 | 113 | return false; |
113 | 114 | } else { |
114 | 115 | element.addClass('validating'); |
115 | | - var options = element.data('jqv'); |
| 116 | + if(userOptions) |
| 117 | + options = methods._saveOptions(element, userOptions); |
| 118 | + else |
| 119 | + options = element.data('jqv'); |
116 | 120 | var valid = methods._validateFields(this); |
117 | 121 |
|
118 | 122 | // If the form doesn't validate, clear the 'validating' class before the user has a chance to submit again |
|
536 | 540 |
|
537 | 541 | if(field.hasClass(options.ignoreFieldsWithClass)) |
538 | 542 | return false; |
539 | | - |
| 543 | + |
540 | 544 | if (!options.validateNonVisibleFields && (field.is(":hidden") && !options.prettySelect || field.parent().is(":hidden"))) |
541 | 545 | return false; |
542 | 546 |
|
|
716 | 720 | break; |
717 | 721 | } |
718 | 722 | } |
719 | | - |
| 723 | + |
720 | 724 | //funcCallRequired, first in rules, and has error, skip anything else |
721 | 725 | if( i==0 && str.indexOf('funcCallRequired')==0 && errorMsg !== undefined ){ |
722 | 726 | promptText += errorMsg + "<br/>"; |
|
2039 | 2043 | // Should we attempt to validate non-visible input fields contained in the form? (Useful in cases of tabbed containers, e.g. jQuery-UI tabs) |
2040 | 2044 | validateNonVisibleFields: false, |
2041 | 2045 | // ignore the validation for fields with this specific class (Useful in cases of tabbed containers AND hidden fields we don't want to validate) |
2042 | | - ignoreFieldsWithClass: 'ignoreMe', |
| 2046 | + ignoreFieldsWithClass: 'ignoreMe', |
2043 | 2047 | // Opening box position, possible locations are: topLeft, |
2044 | 2048 | // topRight, bottomLeft, centerRight, bottomRight, inline |
2045 | 2049 | // inline gets inserted after the validated field or into an element specified in data-prompt-target |
|
0 commit comments