#required attribute not letting me to redirect a drupal 7 form I have a form with 2 buttons. One is a submit button and another is a simple button when clicked, the page has to be redirected to another page.(I mean the user has to be redirected even if he hasn't filled in the entire form)

So after the submit button I put the following code for the other element

&lt;?php 
$form['health_calorie_consume']['view'] = array(
          '#type'=&gt;'button',
      '#value'=&gt;'View stats',
    '#validate'=&gt;array('mymodule_form_view'),
     ); 
?&gt;


inside the mymodule_form_view() function, I put the below code,

&lt;?php
function mymodule_form_view()
  $form_state['redirect'] = 'http://localhost/d7/?q=node/3';
?&gt;


To my surprise, Thhe function gets called but its not redirected..! and shows errors that some of the form fields with #reuired attribute haven't been filled out..! I tried using drupal_goto()function, it redirects to the other page properly but even in the redirected page those, "required" errors show up..!!

I even tried making #required attributes FALSE, inside the mymodule_form_view()and yet it didn't work.

So how to solve this problem..??
Modifying $form_state requires passing it by reference to the function.

function mymodule_form_view(&amp;$form, &amp;$form_state) {
  $form_state['redirect'] = 'http://localhost/d7/?q=node/3';
}