From 68c9543600a6a8dded8195299b5ebf73db0de809 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand <benjamin.bertrand@esss.se> Date: Mon, 9 Apr 2018 17:29:57 +0200 Subject: [PATCH] Do not replace the IP if an error was raised If an error is raised when submitting the form, we should keep the IP that was entered. JIRA INFRA-285 --- app/static/js/hosts.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/static/js/hosts.js b/app/static/js/hosts.js index 1a38304..97b96b3 100644 --- a/app/static/js/hosts.js +++ b/app/static/js/hosts.js @@ -49,7 +49,9 @@ $(document).ready(function() { // - add interface // Do NOT replace the IP on edit interface page load! // (we have to keep the existing IP) - if( $("#hostForm").length || $("#interfaceForm").length ) { + // Do NOT replace the IP if the form was submitted and an error was raised + // (we should display the same value that was submitted) + if( ($("#hostForm").length || $("#interfaceForm").length) && ! $("input").hasClass("is-invalid") ) { set_default_ip(); } -- GitLab