Hi,

I am still new to drupal and was wondering if my approach to the following is ok.

I am developing a module. I have a form with a lot of fields. 1 of those fields is an input for an email address. Currently, on form submit, the input for the email adress is checked through a form validate function, like:

if(!valid_email_address($form_state['values']['email'])) {
form_set_error('email', t('Email is invalid.'));
}

Is this the correct way to do something like this or does drupal have some special form attribute which automatically does this for me?

Btw, drupal is awesome. I used to develop in Joomla and Drupal is a pleasure to work with.

Comments

That would be a correct way

That would be a correct way to valid a field

Thanks!

Thanks!

nobody click here