profile_validate_form

Versions
4.6
profile_validate_form($edit)

▾ 2 functions call profile_validate_form()

profile_admin_add in modules/profile.module
Menu callback; adds a new field to all user profiles.
profile_admin_edit in modules/profile.module
Menu callback; displays the profile field editing form.

Code

modules/profile.module, line 410

<?php
function profile_validate_form($edit) {

  // Validate the title:

  if (!$edit['title']) {
    form_set_error('title', t('You must enter a title.'));
  }

  // Validate the 'form name':

  if (eregi('[^a-z0-9_-]', $edit['name'])) {
    form_set_error('name', t('The specified form name contains one or more illegal characters.  Spaces or any other special characters expect dash (-) and underscore (_) are not allowed.'));
  }

  if (in_array($edit['name'], user_fields())) {
    form_set_error('name', t('The specified form name is reserved for use by Drupal.'));
  }

  // Validate the category:
  if (!$edit['category']) {
    form_set_error('category', t('You must enter a category.'));
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.