I’ve added several fields to user profile using the standard profile tool. Now I want to validate data entered by a user; for example, I added a field called “email” and I want to let the users enter only valid emails to this field.
How can I achieve this?
You can select the field type “email” for profile fields that will automatically validate, but if you wish to do it manually, use hook_form_alter to add a validation callback to the form. Here’s an article that covers the concept – http://befused.com/drupal/additional-validation-function