$form['cancel'] = array (
'#value' => t('Cancel'),
'#type' => 'button',
'#attributes' => array('onclick' => 'location.replace("'. referer_uri() .'"); this.form.reset(); return false;'),
);
location.replace is to redirect url to the previous page, but also we need to reset the field value using this.form.reset() so it wont return an error.