I have two forms on a node page (the comment one + a custom form). Ajax is not enabled for both of them but still, when submitting the custom form form_set_error or durpal_set_message are not displayed but displayed when you load a new page (if you submit the form again, if you reload a page or if you change the page). It's like I have a hidden ajax behavior messing the submit up.
function my_module_quote_request_form($form, &$form_state) {
global $user;
$account = user_load($user->uid);
$user_phone_number = $account->field_user_address[LANGUAGE_NONE][0]['phone_number'] ? $account->field_user_address[LANGUAGE_NONE][0]['phone_number'] : '';
$form = array();
$form['phone_number'] = array(
'#type' => 'textfield',
'#title' => t('Phone number'),
'#default_value' => $user_phone_number,
'#size' => 30,
'#maxlength' => 10,
'#required' => TRUE,
);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#title' => t('Submit'),
'#type' => 'submit',
'#value' => t('Request'),
);
$form['actions']['cancel'] = array(
'#title' => t('Cancel'),
'#markup' => l(t('Cancel'), '/market'),
);
return $form;
}
function my_module_quote_request_form_validate($form, &$form_state) {
if (blabla) {
form_set_error($phone_number, $message);
}
}
If you trigger blabla, then the message is not displayed but displayed on page reload.
Any idea what it can due to?