Nov 5, 2014 – yannickoo Put following function into your module and you can use it for form elements through a #element_validate entry. <?php function element_validate_valid_path($element, &$form_state) { $value = $element['#value']; if (!drupal_valid_path($value)) { form_error($element, t('%name must be a valid path.', array('%name' => $element['#title']))); } }