After creating an element like this:
$form['tel'] = array(
'#type'=>'telfield',
'#title'=>'Votre numéro de téléphone',
'#title_display'=>'invisible',
'#placeholder' => 'Votre numéro de téléphone',
'#pattern'=>'\+?[0-9+*#,;]+',
'#attributes' => array(
'class'=>array('tooltip-me'),
)
);
I get the following error:
Fatal error: Call to undefined function form_validate_pattern() in /home/fullwebfactory/svn_trunk/drupal/includes/form.inc on line 1410
It appears to me that the following function from elements.module is calling a drupal 8 core function, "form_validate_pattern", that is not available in D7.
function elements_process_pattern($element) {
if (isset($element['#pattern']) && !isset($element['#attributes']['pattern'])) {
$element['#attributes']['pattern'] = $element['#pattern'];
$element['#element_validate'][] = 'form_validate_pattern';
}
return $element;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | elements-pattern-validation-2029557-5.patch | 545 bytes | lanny heidbreder |
| #2 | elements.module.process.pattern.patch | 501 bytes | rstaylor |
Comments
Comment #1
rstaylor commentedShould be 'elements_validate_pattern'
Comment #2
rstaylor commentedComment #3
chasingmaxwell commentedLooks good to me. Thanks RSTaylor!
Comment #5
lanny heidbreder commentedPatch rerolled
Comment #6
_Ben commentedI have the same problem. This patch work for me.
Comment #7
nod_Same here, patch fixed the issue.
Comment #9
dave reidCommitted #5 to 7.x-1.x. Sorry about this going unfixed for so long!