title: How to store value entered in an input textfield in a database
body: <p>I am using springsourcetoolsuite, grails project and I am coming across this problem of storing the value entered in the textfield into a table in the database created in mysql and connected to grails. Now I have a domain class called property having variables address, city, 
  zipcode, country etc. which are also fields of the table property in mysql database.
  When I ask user to fill in using this piece of code-(gsp views)</p>
  
  <pre><code>&lt;body&gt;
  &lt;g:textField name="address" maxlength="40" value="${propertyInstance?.address}" /&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>it works and the value is stored in database.
  However I am required to append an input field on each button click, so i have put this input field in a function called add(). Here is the code-</p>
  
  <pre><code>&lt;head&gt;
  &lt;script type="text/javascript"&gt;
  function add() {
      var newP = document.createElement("p");
      var input1,
      area = document.getElementsByTagName("form")[0];
      input1 = document.createElement("input");
      input1.type = "g:textField";
      input1.placeholder = "street";
      input1.value = "${propertyInstance?.address}";
      newP.appendChild(input1);
      area.appendChild(newP);
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;g:form name='prop' method="post" action="save"&gt;
  &lt;input type="button"  value="+Add" onclick= "add();" &gt;&lt;br&gt;
  &lt;g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /&gt;
  &lt;/g:form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Now when i do this and run it, it takes null value and prints an error saying 'address cannot be null'. Now i cannot see what is wrong, but if anyone is familiar with groovy/javscript.. please help me figure out whats wrong.
  Thanks a lot.</p>