You are here

function _webform_edit_file_rename_validate in Webform 7.4

Form API validator ensures rename string is empty or contains one token.

A Form API element validate function to ensure that the rename string is either empty or contains at least one token.

1 string reference to '_webform_edit_file_rename_validate'
_webform_edit_file in components/file.inc
Implements _webform_edit_component().

File

components/file.inc, line 203
Webform module file component.

Code

function _webform_edit_file_rename_validate($element, &$form_state, $form) {
  $rename = trim($form_state['values']['extra']['rename']);
  form_set_value($element, $rename, $form_state);
  if (strlen($rename) && !count(token_scan($rename))) {
    form_error($element, t('To create unique file names, use at least one token in the file name pattern.'));
  }
}