This commit is contained in:
SBD
2023-12-09 21:30:12 +03:00
parent 470914f431
commit 49507dae19
4 changed files with 67 additions and 12 deletions

View File

@@ -480,6 +480,10 @@ body.n_scroll{
flex-direction: row-reverse;
}
.container_input{
margin-bottom: 25px;
}
.input_form_feedback{
border: none;
border-bottom: 1px solid #E3E3E3;
@@ -491,7 +495,6 @@ body.n_scroll{
outline: none;
padding-bottom: 5px;
padding-left: 20px;
margin-bottom: 25px;
}
.input_form_feedback.error{
@@ -571,7 +574,7 @@ body.n_scroll{
}
.check_box_form_feedback{
border: 1px solid #9a9a9a;
border: 1px solid #000000;
background: none;
display: inline-block;
width: 15px;
@@ -579,6 +582,9 @@ body.n_scroll{
outline: none;
margin: 6px 0;
}
.check_box_form_feedback.error{
border: 1px solid #FF3F20;
}
.label_feedback_form_checkbox{
font-size: 12px;
@@ -587,6 +593,9 @@ body.n_scroll{
width: 90%;
float: right;
}
.label_feedback_form_checkbox.error{
color: #FF3F20;
}
/* block plugin*/
@@ -1221,4 +1230,16 @@ body.n_scroll{
border: 1px solid #E3E3E3;
background: #FFF;
box-shadow: 1px 1px 2px 0 rgba(151, 167, 176, 0.20);
}
}
/* errors */
.error_input_html{
color: #FF3F20;
padding: 10px 0 0 0;
}
.error_input_html ul,li{
padding: 0;
margin: 0;
list-style: none;
}

View File

@@ -253,7 +253,29 @@ function sendFormfeedback (el){
document.querySelector(".container_content_form_feedback").innerHTML = data.html
},
error: function (data){
document.querySelector(".container_content_form_feedback").innerHTML = data.responseJSON.html
document.querySelector(".form_feedback_content").innerHTML = data.responseJSON.left_form_html
document.querySelector(".checkbox_container").innerHTML = data.responseJSON.right_form_html
}
});
}
function deleteErrorsInput (el) {
let parent = el.parentNode
let errors_container = parent.querySelector(".error_input_html")
if (errors_container){
let input = parent.querySelector(".input_form_feedback")
let checkbox_label = parent.querySelector(".label_feedback_form_checkbox")
if (input){
input.classList.remove('error')
} else if (checkbox_label){
checkbox_label.classList.remove("error")
} else {
let textarea = document.querySelector(".textarea_form_feedback")
textarea.classList.remove("error")
}
let str = errors_container.outerHTML
str = str.replace(str,'')
errors_container.outerHTML = str
}
}

View File

@@ -1,8 +1,19 @@
{% load static %}
<input hidden="hidden" class="input_form_feedback" id="id_form_name" name="form_name" value="{{ feedback_form.initial.form_name }}">
<input class="input_form_feedback{% if feedback_form.errors.name %} error{% endif %}" id="id_name" name="name" placeholder="{{ feedback_form.name.label }}">
<div class="error"></div>
<input class="input_form_feedback{% if feedback_form.errors.company %} error{% endif %}{% if feedback_form.errors.name %} error{% endif %}" id="id_company" name="company" placeholder="{{ feedback_form.company.label }}">
<input class="input_form_feedback{% if feedback_form.errors.contacts %} error{% endif %}" id="id_contacts" name="contacts" placeholder="{{ feedback_form.contacts.label }}">
<label class="label_feedback_form standart_txt" for="id_description">{{ feedback_form.description.label }}</label>
<textarea class="textarea_form_feedback{% if feedback_form.errors.description %} error{% endif %}" id="id_description" name="description"></textarea>
<div class="container_input">
<input oninput="deleteErrorsInput(this)" class="input_form_feedback{% if feedback_form.errors.name %} error{% endif %}" id="id_name" name="name" placeholder="{{ feedback_form.name.label }}"{% if feedback_form.initial.name %} value="{{ feedback_form.initial.name }}"{% endif %}>
{% if feedback_form.errors.name %}<div class="error_input_html">{{ feedback_form.errors.name }}</div>{% endif %}
</div>
<div class="container_input">
<input oninput="deleteErrorsInput(this)" class="input_form_feedback{% if feedback_form.errors.company %} error{% endif %}{% if feedback_form.errors.company %} error{% endif %}" id="id_company" name="company" placeholder="{{ feedback_form.company.label }}" {% if feedback_form.initial.company %} value="{{ feedback_form.initial.company }}"{% endif %}>
{% if feedback_form.errors.company %}<div class="error_input_html">{{ feedback_form.errors.company }}</div>{% endif %}
</div>
<div class="container_input">
<input oninput="deleteErrorsInput(this)" class="input_form_feedback{% if feedback_form.errors.contacts %} error{% endif %}" id="id_contacts" name="contacts" placeholder="{{ feedback_form.contacts.label }}"{% if feedback_form.initial.contacts %} value="{{ feedback_form.initial.contacts }}"{% endif %}>
{% if feedback_form.errors.contacts %}<div class="error_input_html">{{ feedback_form.errors.contacts }}</div>{% endif %}
</div>
<div>
<label class="label_feedback_form standart_txt" for="id_description">{{ feedback_form.description.label }}</label>
<textarea oninput="deleteErrorsInput(this)" class="textarea_form_feedback{% if feedback_form.errors.description %} error{% endif %}" id="id_description" name="description">{% if feedback_form.initial.description %}{{ feedback_form.initial.description }}{% endif %}</textarea>
{% if feedback_form.errors.description %}<div class="error_input_html">{{ feedback_form.errors.description }}</div>{% endif %}
</div>

View File

@@ -1,4 +1,5 @@
{% load static %}
<input type="checkbox" class="check_box_form_feedback" id="id_agreement" name="agreement" />
<label class="label_feedback_form_checkbox standart_txt" for="id_agreement">{{ feedback_form.agreement.label }}</label>
<input type="checkbox" onclick="deleteErrorsInput(this)" class="check_box_form_feedback{% if feedback_form.errors.agreement %} error{% endif %}" id="id_agreement" name="agreement" {% if feedback_form.initial.agreement %}checked{% endif %} />
<label class="label_feedback_form_checkbox{% if feedback_form.errors.agreement %} error{% endif %} standart_txt" for="id_agreement">{{ feedback_form.agreement.label }}</label>
{% if feedback_form.errors.company %}<div class="error_input_html"></div>{% endif %}
<div class="clear_both"></div>