title: Cakephp - Create a search field with a search button
body: <p>I need an "onclick" action on the button so i get redirected for something like this:</p>
  
  <pre><code> location/[textfield_data]
  </code></pre>
  
  <ul>
  <li><a href="http://snag.gy/wz395.jpg" rel="nofollow">http://snag.gy/wz395.jpg</a></li>
  </ul>
  
  <p>I am using <strong>cakephp</strong> and at this moment the nearest i reached was this.</p>
  
  <pre><code>echo $this-&gt;Form-&gt;input('link', array('label' =&gt; false, "class" =&gt; "form-control input-medium", "placeholder" =&gt; __('Procurar')));
  
  echo $this-&gt;Form-&gt;button('', array('class' =&gt; 'btn btn-primary icon-search icon-white' ,'onclick' =&gt; "location.href='/'"));
  </code></pre>
  
  <p>With my code, cakephp is retrieving me this:</p>
  
  <pre><code>/[view]?data%5Blink%5D=
  </code></pre>
  
  <p>The [view] is the current page i am in.</p>
  
  <p><strong>FOUND THE SOLUTION</strong></p>
  
  <p>Ive found the solution this way.</p>
  
  <pre><code>echo $this-&gt;Form-&gt;input('link', array('label' =&gt; false, "class" =&gt; " form-control input-medium", "placeholder" =&gt; __('Procurar'), 'id' =&gt; 'search'));
  
  echo $this-&gt;Form-&gt;button(null, array('class' =&gt; 'btn btn-primary icon-search icon-white' ,'onclick' =&gt; "location.href='/mywantedurl/'+document.getElementById('search').value;"));
  </code></pre>
  
  <p><strong>Note that i didnt use any form->create or form->end, otherwise it wont work.</strong></p>