* Finish task #84584.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
$(function()
|
||||
{
|
||||
$('input').on('change', function()
|
||||
{
|
||||
$(this).removeClass('has-error');
|
||||
$(this).closest('td').find('.text-danger.help-text').remove();
|
||||
});
|
||||
});
|
||||
/**
|
||||
* Add item to create view of programplan.
|
||||
*
|
||||
@@ -30,3 +38,44 @@ function deleteItem(obj)
|
||||
if($('#planForm .table tbody').children().length < 2) return false;
|
||||
$(obj).closest('tr').remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add row errors.
|
||||
*
|
||||
* @param array $rowErrors
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function addRowErrors(rowErrors)
|
||||
{
|
||||
var errorFieldID, errorTip, errorHTML;
|
||||
$('.text-danger.help-text').remove();
|
||||
$('input').removeClass('has-error');
|
||||
var index = 0;
|
||||
var alterError = '';
|
||||
$('input[name^=names]').each(function()
|
||||
{
|
||||
if($(this).val() == '') return true;
|
||||
|
||||
if(typeof rowErrors[index] == 'object')
|
||||
{
|
||||
for(var errorField in rowErrors[index])
|
||||
{
|
||||
$errorTD = $(this).closest('tr').find('input[name^=' + errorField + ']').closest('td');
|
||||
errorTip = rowErrors[index][errorField];
|
||||
errorHTML = '<div id="help' + errorField + index + '" class="text-danger help-text">' + errorTip + '</div>';
|
||||
$errorTD.append(errorHTML);
|
||||
$errorTD.find('input').addClass('has-error');
|
||||
}
|
||||
}
|
||||
if(typeof rowErrors['percent'] == 'string')
|
||||
{
|
||||
errorFieldID = $(this).closest('tr').find('input[name^=percent]').attr('id');
|
||||
errorHTML = '<div id="help' + errorFieldID + '" class="text-danger help-text">' + rowErrors['percent'] + '</div>';
|
||||
$('#' + errorFieldID).closest('td').append(errorHTML);
|
||||
$('#' + errorFieldID).closest('td').find('input').addClass('has-error');
|
||||
}
|
||||
|
||||
index ++;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user