Skip to content

Commit

Permalink
Fix mutual submit issue on forms
Browse files Browse the repository at this point in the history
  • Loading branch information
blues-man committed Aug 31, 2021
1 parent 31e9796 commit 37c89a1
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions supplemental-ui/partials/header-content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
showCluster( clusterName );
}
else {
showForm();
showClusterForm();
}
if (projectName) {
Expand All @@ -22,22 +22,27 @@
document.getElementById('navbar-form-empty').style.display = "none";
document.getElementById('navbar-form-filled').style.display = "flex";
document.getElementById('cluster_subdomain').textContent = clusterName;
document.getElementById('clusterfield2').value = clusterName;
}
function showForm( clusterName ) {
function showClusterForm( clusterName ) {
document.getElementById('navbar-form-empty').style.display = "flex";
document.getElementById('navbar-form-filled').style.display = "none";
}
function gowithcluster() {
elInput = document.getElementById('clusterfield');
window.location.search = ('&CLUSTER_SUBDOMAIN=' + elInput.value);
elClusterInput = document.getElementById('clusterfield');
elProjectInput = document.getElementById('projectfield2');
window.location.search = ('&CLUSTER_SUBDOMAIN=' + elClusterInput.value + '&PROJECT=' + elProjectInput.value);
}
function showProject( projectName ) {
document.getElementById('navbar-form-project-empty').style.display = "none";
document.getElementById('navbar-form-project-filled').style.display = "flex";
document.getElementById('project').textContent = projectName;
document.getElementById('projectfield2').value = projectName;
}
function showProjectForm( projectName ) {
Expand All @@ -46,8 +51,9 @@
}
function gowithproject() {
elInput = document.getElementById('projectfield');
window.location.search = ('&PROJECT=' + elInput.value);
elProjectInput = document.getElementById('projectfield');
elClusterInput = document.getElementById('clusterfield2');
window.location.search = ('&CLUSTER_SUBDOMAIN=' + elClusterInput.value + '&PROJECT=' + elProjectInput.value);
}
</script>
Expand All @@ -70,6 +76,7 @@

<form action="javascript:void(0);" onsubmit="gowithcluster();">
<input size="40" id="clusterfield" type="text" placeholder="Enter Cluster Subdomain">
<input type="hidden" id="projectfield2" name="projectfield2" value="">
</form>
</div>

Expand All @@ -85,6 +92,7 @@

<form action="javascript:void(0);" onsubmit="gowithproject();">
<input size="40" id="projectfield" type="text" placeholder="Enter Project Name">
<input type="hidden" id="clusterfield2" name="clusterfield2" value="">
</form>
</div>

Expand Down

0 comments on commit 37c89a1

Please sign in to comment.