Merge pull request #139 from JapSeyz/AjaxFix
Replaced manual function with existing one.
This commit is contained in:
commit
901bd0218c
|
|
@ -53,24 +53,9 @@ $(function() {
|
|||
|
||||
case 'error':
|
||||
if (data.messages) {
|
||||
$.each(data.messages, function(index, error) {
|
||||
|
||||
/*
|
||||
* use the class as the selector if the input name is an array.
|
||||
*/
|
||||
var selector = (index.indexOf(".") >= 0) ? '.' + index.replace(/\./g, "\\.") : ':input[name=' + index + ']';
|
||||
|
||||
$(selector, $form)
|
||||
.after('<div class="help-block error">' + error + '</div>')
|
||||
.parent()
|
||||
.addClass('has-error');
|
||||
});
|
||||
processFormErrors($form, data.messages);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var $submitButton = $form.find('input[type=submit]');
|
||||
toggleSubmitDisabled($submitButton);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -182,7 +167,8 @@ function processFormErrors($form, errors)
|
|||
{
|
||||
$.each(errors, function (index, error)
|
||||
{
|
||||
var $input = $(':input[name=' + index + ']', $form);
|
||||
var selector = (index.indexOf(".") >= 0) ? '.' + index.replace(/\./g, "\\.") : ':input[name=' + index + ']';
|
||||
var $input = $(selector, $form);
|
||||
|
||||
if ($input.prop('type') === 'file') {
|
||||
$('#input-' + $input.prop('name')).append('<div class="help-block error">' + error + '</div>')
|
||||
|
|
|
|||
|
|
@ -4621,24 +4621,9 @@ function log() {
|
|||
|
||||
case 'error':
|
||||
if (data.messages) {
|
||||
$.each(data.messages, function(index, error) {
|
||||
|
||||
/*
|
||||
* use the class as the selector if the input name is an array.
|
||||
*/
|
||||
var selector = (index.indexOf(".") >= 0) ? '.' + index.replace(/\./g, "\\.") : ':input[name=' + index + ']';
|
||||
|
||||
$(selector, $form)
|
||||
.after('<div class="help-block error">' + error + '</div>')
|
||||
.parent()
|
||||
.addClass('has-error');
|
||||
});
|
||||
processFormErrors($form, data.messages);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var $submitButton = $form.find('input[type=submit]');
|
||||
toggleSubmitDisabled($submitButton);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -4750,7 +4735,8 @@ function processFormErrors($form, errors)
|
|||
{
|
||||
$.each(errors, function (index, error)
|
||||
{
|
||||
var $input = $(':input[name=' + index + ']', $form);
|
||||
var selector = (index.indexOf(".") >= 0) ? '.' + index.replace(/\./g, "\\.") : ':input[name=' + index + ']';
|
||||
var $input = $(selector, $form);
|
||||
|
||||
if ($input.prop('type') === 'file') {
|
||||
$('#input-' + $input.prop('name')).append('<div class="help-block error">' + error + '</div>')
|
||||
|
|
|
|||
Loading…
Reference in New Issue