title: How can I pass some values from gsp to controller in a g:form?
body: <p>I know there are some questions like mine, but I'm hoping to get an explanation of how to do it in Grails.</p>
  
  <p>What I want to do is pass values from a gsp datepicker and textfield to the controller when upon Submit button press.</p>
  
  <p>My thanks in advance</p>
  
  <p>GSP:</p>
  
  <pre><code>&lt;g:form action="generateReport"&gt;
      &lt;ol&gt;
          &lt;li class="fieldcontain"&gt;
              &lt;div class="fieldcontain required"&gt;
                  &lt;label for="date" style="padding-left: 210px;"&gt;
                      &lt;g:message code="Data" default="Data"/&gt;
                      &lt;span class="required-indicator"&gt;*&lt;/span&gt;
                      &lt;g:datePicker id="data" name="datapicker" precision="day"&gt;&lt;/g:datePicker&gt;
                  &lt;/label&gt;
              &lt;/div&gt;
          &lt;/li&gt;
          &lt;li class="fieldcontain"&gt;
              &lt;div class="fieldcontain required"&gt;
                  &lt;label for="date" style="padding-left: 195px;"&gt;
                      &lt;g:message code="Time" default="Time"/&gt;
                      &lt;g:textField name="minutes"/&gt;
                  &lt;/label&gt;
              &lt;/div&gt;
          &lt;/li&gt;
      &lt;/ol&gt;
  
      &lt;div class="content scaffold-show" style="padding-left: 50px;"&gt;
          &lt;g:submitButton value="search" name="button"/&gt;
      &lt;/div&gt;
  &lt;/g:form&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>def generateReport(){
      log.info("Button pressed")
      redirect(action: "list")        
  }
  </code></pre>