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 @@ ...@@ -603,7 +603,7 @@
label, label,
div_input, div_input,
span_info, span_info,
span_error, error_message,
input, input,
first_path, first_path,
queue = RSVP.Queue(); queue = RSVP.Queue();
...@@ -732,9 +732,10 @@ ...@@ -732,9 +732,10 @@
span_info.textContent = json_field.info; span_info.textContent = json_field.info;
div_input.appendChild(span_info); div_input.appendChild(span_info);
} }
span_error = document.createElement("span"); error_message = document.createElement("span");
span_error.setAttribute("class", "error"); error_message.setAttribute("class", "error");
div_input.appendChild(span_error); error_message.hidden = true;
div_input.appendChild(error_message);
div.appendChild(div_input); div.appendChild(div_input);
return queue return queue
...@@ -1235,8 +1236,9 @@ ...@@ -1235,8 +1236,9 @@
var index, var index,
tasks = []; tasks = [];
g.element.querySelectorAll("span.error").forEach(function (span) { g.element.querySelectorAll(".error").forEach(function (error_message) {
span.textContent = ""; error_message.textContent = "";
error_message.hidden = true;
}); });
g.element.querySelectorAll("div.error-input").forEach(function (div) { g.element.querySelectorAll("div.error-input").forEach(function (div) {
...@@ -1250,9 +1252,12 @@ ...@@ -1250,9 +1252,12 @@
} }
function print_error(message) { function print_error(message) {
return function (element) { return function (element) {
var id = element.id; var id = element.id,
error_message;
element.setAttribute("class", "error-input"); 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) { 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