2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-01 21:16:46 +00:00

Display per-line errors

This commit is contained in:
Oliver 2021-07-12 19:42:06 +10:00
parent 51314a0261
commit 5329e3e56c
2 changed files with 19 additions and 22 deletions

View File

@ -816,7 +816,6 @@ function handleFormErrors(errors, fields, options) {
}
for (field_name in errors) {
if (field_name in fields) {
// Add the 'has-error' class
$(options.modal).find(`#div_id_${field_name}`).addClass('has-error');
@ -837,12 +836,7 @@ function handleFormErrors(errors, fields, options) {
field_dom.append(html);
}
} else {
console.log(`WARNING: handleFormErrors found no match for field '${field_name}'`);
}
}
}

View File

@ -167,7 +167,12 @@ function adjustStock(items, options={}) {
<td id='part_${pk}'><img src='${image}' class='hover-img-thumb'> ${item.part_detail.full_name}</td>
<td id='stock_${pk}'>${quantity}${status}</td>
<td id='location_${pk}'>${location}</td>
<td id='action_${pk}'>${actionInput}</td>
<td id='action_${pk}'>
<div id='div_id_${pk}'>
${actionInput}
<div id='errors-${pk}'></div>
</div>
</td>
<td id='buttons_${pk}'>${buttons}</td>
</tr>`;
@ -259,8 +264,6 @@ function adjustStock(items, options={}) {
error: function(xhr) {
switch (xhr.status) {
case 400:
console.log('400 bad request');
console.log(xhr.responseJSON);
// Handle errors for standard fields
handleFormErrors(