There is a form component on which I added a function

$form['submitted']['tel']['#element_validate'][] = '_custorm_validation_form_validate';

in the function itself wrote the following..

$subject = $element['#value'];
        if($element['#webform_component']['form_key'] == 'tel'){
            $pattern = '/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/';
            $result = preg_match($pattern, $subject);
                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:

$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.