You are here

function _javascript_libraries_url_validate in JavaScript Libraries Manager 7

1 call to _javascript_libraries_url_validate()
javascript_libraries_edit_form_validate in ./javascript_libraries.admin.inc
Form validate for javascript_libraries_edit_form().

File

./javascript_libraries.admin.inc, line 496
Administrative management forms for JavaScript libraries.

Code

function _javascript_libraries_url_validate($form, &$form_state) {
  $form_state['values']['external_url'] = trim($form_state['values']['external_url']);
  if (strlen($form_state['values']['external_url']) == 0) {
    form_set_error('external_url', t('An empty URL is invalid.'));
  }
  elseif (!javascript_libraries_valid_external_url($form_state['values']['external_url'])) {
    form_set_error('external_url', t('This URL does not start with http:// or does not end with ".js" or ".txt".'));
  }
}