Commits

Anonymous committed 88c8ceb

dynamically display the password field depending on auth type.

  • Participants
  • Parent commits 6f11d3f

Comments (0)

Files changed (1)

File frontend/js/bespin/deploy.js

                     tr = dojo.create("tr", {}, table);
                     td = dojo.create("td", {innerHTML: "Authentication type:"}, tr);
                     td = dojo.create("td", {}, tr);
-                    select = dojo.create("select", {name: "authType"}, td);
+                    select = dojo.create("select", {name: "authType",
+                        onchange: function(e) {
+                            if (this.value == "ssh") {
+                                dojo.style(pwrow, "display", "none");
+                            } else {
+                                dojo.style(pwrow, "display", "table-row");
+                            }
+                        }}, td);
                     bespin.deploy._createOption(select, "ssh", "SSH Key",
                         currentSetup.authType);
                     bespin.deploy._createOption(select, 
                         value: currentSetup.username || ""}, td);
 
                     // Password
-                    tr = dojo.create("tr", {}, table);
-                    td = dojo.create("td", {innerHTML: "Password:"}, tr);
-                    td = dojo.create("td", {}, tr);
+                    pwrow = dojo.create("tr", {}, table);
+                    td = dojo.create("td", {innerHTML: "Password:"}, pwrow);
+                    td = dojo.create("td", {}, pwrow);
                     dojo.create("input", {type: "password", name: "password",
                         value: currentSetup.password || ""}, td);
+                    
+                    if (!currentSetup.authType || currentSetup.authType == "ssh") {
+                        dojo.style(pwrow, "display", "none");
+                    }
 
                     // Buttons
                     tr = dojo.create("tr", {}, table);