Skip to content
Snippets Groups Projects
Commit 343fbdb0 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Clear error messages on form fields on change

The class "is-invalid" is removed on all type=text input
on keyup event.

JIRA INFRA-285
parent c302b5e3
No related branches found
No related tags found
No related merge requests found
$(document).ready(function() {
// When an invalid input was submitted, the server
// adds the "is-invalid" class to form fields to display
// them in red with an error message
// When starting to type again, we want to remove the error
// message to not confuse the user
$('input[type="text"]').keyup(function(event) {
$(this).removeClass("is-invalid");
});
});
......@@ -71,6 +71,10 @@ $(document).ready(function() {
$("#name").keyup(function(event) {
var hostname = $(this).val();
$("#interface_name").val(hostname);
// If an invalid hostname was submitted, the interface name
// will be invalid as well
// Remove the invalid messages when starting typing a new name
$("#interface_name").removeClass("is-invalid");
});
// Fill MAC address on page load
......
......@@ -65,5 +65,6 @@
<script type=text/javascript>
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
</script>
<script src="{{ url_for('static', filename='js/csentry.js') }}"></script>
{% block csentry_scripts %}{% endblock %}
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment