Reply To: Get value from custom HTML input structure

Home Forums Quform WordPress Get value from custom HTML input structure Reply To: Get value from custom HTML input structure

#34785
Rafal
Participant

Thanks for your quick help.
I have one last problem.
I would like to change validator text for custom inputs.

So I replace:


$field->addValidator(new Quform_Validator_Required());

to:


$field->addValidator('required', array(
    'messages' => array('required' => 'Yardage is required!')
));

according to the documentation: https://support.themecatcher.net/quform-php/customisation/validators/changing-the-required-error-message-this-field-is-required

But it doesn’t work for me.

Full code:


add_filter('quform_pre_validate_1', function (array $result, Quform_Form $form) {
    $field = $form->getElement('quform_1_53');
    if($field instanceof Quform_Element_Field) {
        /* $field->addValidator(new Quform_Validator_Required()); */
        $field->addValidator('required', array(
            'messages' => array('required' => 'Yardage is required!')
        ));
    }
    return $result;
},10, 2);
  • This reply was modified 1 month, 4 weeks ago by Rafal.
  • This reply was modified 1 month, 4 weeks ago by Rafal.
  • This reply was modified 1 month, 4 weeks ago by Rafal.
Be inspired. © 2022 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy