Advertisement
obernardovieira

Form with unknown ammount of params

Sep 15th, 2017
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.06 KB | None | 0 0
  1. <html>
  2.     <head>
  3.         <script type="text/javascript">
  4.             var nParam = 0;
  5.             function addParameters() {
  6.                 document.getElementById("parameters").innerHTML +=
  7.                     "Name : <input type=\"text\" name=\"params[" + nParam + "][name]\"><br>" +
  8.                     "Type : <select name=\"params[" + nParam + "][type]\">" +
  9.                         "<option value=\"INT\">int</option>" +
  10.                         "<option value=\"DOUBLE\">float</option>" +
  11.                         "<option value=\"STRING\">string</option>" +
  12.                         "<option value=\"TEXT\">text</option>" +
  13.                     "</select><br>";
  14.  
  15.                 nParam ++;
  16.             }
  17.         </script>
  18.     </head>
  19.     <body>
  20.         <form class="" action="index.html" method="post">
  21.             Category Name : <input type="text" name="category-name"><br>
  22.             Parameters :<br>
  23.             <div id="parameters"></div>
  24.             <input type="button" value="Add" onclick="addParameters()">
  25.         </form>
  26.     </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement