Wednesday, August 22, 2012

How to validate froms in Drupal 7?

Drupal Form validations

Here you can get the form values from form_state 

Below is the simple example for form validations  

function test_form_validate($form, &$form_state) {
  if (
$form_state['values']['name'] == '') {
    
form_set_error('name', t('You must select a name for this group of settings.'));
  }
}

No comments:

Post a Comment