-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed #452 #454
Fixed #452 #454
Conversation
resources/assets/js/jsvalidation.js
Outdated
validator.showErrors(); | ||
} else { | ||
var errors = {}; | ||
errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long.
if (laravelValidation.methods[rule] !== undefined) { | ||
$.each(values, function(index, value) { | ||
validated = laravelValidation.methods[rule].call(validator, value, element, param[1], function(valid) { | ||
validator.settings.messages[element.name].laravelValidationRemote = previous.originalMessage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long.
validator.showErrors( errors ); | ||
if (laravelValidation.methods[rule] !== undefined) { | ||
$.each(values, function(index, value) { | ||
validated = laravelValidation.methods[rule].call(validator, value, element, param[1], function(valid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long.
if ( !implicit && validator.optional( element ) ) { | ||
validated="dependency-mismatch"; | ||
if (! implicit && validator.optional(element)) { | ||
validated = "dependency-mismatch"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixed double and single quotes.
$.each(rules, function (i, param) { | ||
var implicit = param[3] || laravelValidation.implicitRules.indexOf(param[0])!== -1; | ||
var implicit = param[3] || laravelValidation.implicitRules.indexOf(param[0]) !== -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long.
If you use Ideally need to split it so rules without |
if (param[3] || laravelValidation.implicitRules.indexOf(param[0]) !== -1) { | ||
isArrayRule ? arrayRules.unshift(param) : rules.unshift(param); | ||
} else { | ||
isArrayRule ? arrayRules.push(param) : rules.push(param); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected an assignment or function call and instead saw an expression.
// put Implicit rules in front | ||
var isArrayRule = param[4].indexOf('[') !== -1; | ||
if (param[3] || laravelValidation.implicitRules.indexOf(param[0]) !== -1) { | ||
isArrayRule ? arrayRules.unshift(param) : rules.unshift(param); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected an assignment or function call and instead saw an expression.
$.each(params, function (i, param) { | ||
// put Implicit rules in front | ||
var isArrayRule = param[4].indexOf('[') !== -1; | ||
if (param[3] || laravelValidation.implicitRules.indexOf(param[0]) !== -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long.
* Create JQueryValidation check to validate Laravel rules. | ||
*/ | ||
|
||
$.validator.addMethod("laravelValidation", function (value, element, params) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixed double and single quotes.
if (name in cache[element.name]) { | ||
$.extend(rules, cache[element.name][name]); | ||
rules = laravelValidation.helpers.mergeRules(rules, cache[element.name][name]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long.
continue; | ||
} | ||
|
||
if (typeof rules[key] === "undefined") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixed double and single quotes.
'laravelValidationRemote': newRules.laravelValidationRemote || [] | ||
}; | ||
|
||
for (var key in rulesList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.
var errors = {}; | ||
errors[ element.name ] | ||
= previous.message | ||
= typeof message === "function" ? message( value ) : message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long.
Misleading line break before '='; readers may interpret this as an expression boundary.
Mixed double and single quotes.
} else { | ||
var errors = {}; | ||
errors[ element.name ] | ||
= previous.message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misleading line break before '='; readers may interpret this as an expression boundary.
Description
Uses
$.each
on array inputs. Array inputs are only returned on select-multiple elements.This fix somewhat clashes with #453
In the case of
['domain' => 'array', 'domain.*' => 'max:2']
arrayRules
overwrites the'domain'
rules.