Commit 42b8f77d authored by Boris Kocherov's avatar Boris Kocherov

erro_message element hide if not contain error message

parent 519056da
......@@ -603,7 +603,7 @@
label,
div_input,
span_info,
span_error,
error_message,
input,
first_path,
queue = RSVP.Queue();
......@@ -732,9 +732,10 @@
span_info.textContent = json_field.info;
div_input.appendChild(span_info);
}
span_error = document.createElement("span");
span_error.setAttribute("class", "error");
div_input.appendChild(span_error);
error_message = document.createElement("span");
error_message.setAttribute("class", "error");
error_message.hidden = true;
div_input.appendChild(error_message);
div.appendChild(div_input);
return queue
......@@ -1235,8 +1236,9 @@
var index,
tasks = [];
g.element.querySelectorAll("span.error").forEach(function (span) {
span.textContent = "";
g.element.querySelectorAll(".error").forEach(function (error_message) {
error_message.textContent = "";
error_message.hidden = true;
});
g.element.querySelectorAll("div.error-input").forEach(function (div) {
......@@ -1250,9 +1252,12 @@
}
function print_error(message) {
return function (element) {
var id = element.id;
var id = element.id,
error_message;
element.setAttribute("class", "error-input");
element.querySelector("#" + id.replace("/", "\\/") + " > span.error").textContent = message;
error_message = element.querySelector("#" + id.replace("/", "\\/") + " > .error");
error_message.textContent = message;
error_message.hidden = false;
};
}
for (index in validation.errors) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment