Ich versuche, einige Drupal 6 Form Code zu ändern und einige native Form Validierung zu integrieren. Der Code sieht so aus, aber die Validierung funktioniert nicht. Ich komme nie in Funktion thisFormName_form_validate. Irgendwelche Drupalianer haben einige gute Ideen?Drupal Formular Validierung funktioniert nicht für mich
function thisFormName_form_alter(&$form, $form_state, $form_id) {
$form['email_address'] = array(
'#type' => 'textfield',
'#title' => t('Enter your email address (optional)'),
'#default_value' => $object['email_address'],
'#weight' => 4,
'#size' => 60,
'#maxlength' => 128,
'#description' => t('Enter email address.'),
);
function thisFormName_form_validate($node, &$form) {
if ($form_state['values']['email_address'] == '')
{
form_set_error('', t('Email must be valid format if entered.'));
}
}
+1 - Haben Sie nicht bemerkt hatte bereits beantwortet - sorry für redundante Entsendung von ähnlichen Antwort. –