0

There is a form component on which I added a function

<?php
$form['submitted']['tel']['#element_validate'][] = '_custorm_validation_form_validate';
?>

in the function itself wrote the following..

<?php
$subject = $element['#value'];
        if($element['#webform_component']['form_key'] == 'tel'){
            $pattern = '/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/';
            $result = preg_match($pattern, $subject);
            if(!$result){
                form_error($element, 'Поле Телефон заполненно некорректно');
            };                
        }
?>

the message pops up above the form. How can I create an new block in a form in which I can put this message? I tried this:

<?php
$form['submitted']['tel']['#webform_component']['#suffix'] =  'my error message';
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.