function commerce_usps_settings_form_validate in Commerce USPS 7
Same name and namespace in other branches
- 7.2 includes/commerce_usps.admin.inc \commerce_usps_settings_form_validate()
Validate handler: valiates the usps settings form.
File
- ./
commerce_usps.inc, line 86 - Admin functions for Commerce USPS.
Code
function commerce_usps_settings_form_validate($form, $form_state) {
// Check for a valid postal code
$postal_code = $form_state['values']['commerce_usps_postal_code'];
if (!is_numeric($postal_code) || strlen($postal_code) != 5) {
form_set_error('commerce_usps_postal_code', t('You must enter a 5 digit zip code'));
}
// Disallow USPS testing urls.
$connection_address = $form_state['values']['commerce_usps_connection_address'];
if (preg_match('/testing/', drupal_strtolower($connection_address))) {
form_set_error('commerce_usps_connection_address', t('Only production urls will work with this module. Please have USPS exdend production access to your Webtools account by calling or emailing them.'));
}
}