Updates for modal forms:

- Fix css classes
This commit is contained in:
Oliver 2021-10-27 16:48:45 +11:00
parent abf2093ab9
commit 219191eb6a
2 changed files with 15 additions and 10 deletions

View File

@ -775,6 +775,14 @@
padding: 5px;
}
.form-group {
padding-bottom: 15px;
}
.form-field-error {
color: #A94442;
}
.modal input {
width: 100%;
@ -793,6 +801,7 @@ input[type="submit"] {
/* Force a control-label div to be 100% width */
.modal .control-label {
width: 100%;
font-weight: 700;
margin-top: 5px;
}
@ -1086,10 +1095,6 @@ a.anchor {
padding: 6px 6px;
}
.form-control {
height: 30px;
}
/* Force minimum width of number input fields to show at least ~5 digits */
input[type='number']{
min-width: 80px;

View File

@ -927,7 +927,7 @@ function clearFormErrors(options) {
$(options.modal).find('.form-error-message').remove();
// Remove the "has error" class
$(options.modal).find('.has-error').removeClass('has-error');
$(options.modal).find('.form-field-error').removeClass('form-field-error');
// Hide the 'non field errors'
$(options.modal).find('#non-field-errors').html('');
@ -1100,8 +1100,8 @@ function handleFormErrors(errors, fields, options) {
*/
function addFieldErrorMessage(field_name, error_text, error_idx, options) {
// Add the 'has-error' class
$(options.modal).find(`#div_id_${field_name}`).addClass('has-error');
// Add the 'form-field-error' class
$(options.modal).find(`#div_id_${field_name}`).addClass('form-field-error');
var field_dom = $(options.modal).find(`#errors-${field_name}`);
@ -1754,7 +1754,7 @@ function constructField(name, parameters, options) {
var form_classes = 'form-group';
if (parameters.errors) {
form_classes += ' has-error';
form_classes += ' form-field-error';
}
// Optional content to render before the field
@ -1796,7 +1796,7 @@ function constructField(name, parameters, options) {
html += `<div class='input-group'>`;
if (parameters.prefix) {
html += `<span class='input-group-addon'>${parameters.prefix}</span>`;
html += `<span class='input-group-text'>${parameters.prefix}</span>`;
}
}
@ -1806,7 +1806,7 @@ function constructField(name, parameters, options) {
if (!parameters.required) {
html += `
<span class='input-group-addon form-clear' id='clear_${name}' title='{% trans "Clear input" %}'>
<span class='input-group-text form-clear' id='clear_${name}' title='{% trans "Clear input" %}'>
<span class='icon-red fas fa-backspace'></span>
</span>`;
}