Fatal Error when adding a 2nd Validator in process.php

Home Forums Quform PHP Fatal Error when adding a 2nd Validator in process.php

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Ally 4 weeks, 1 day ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29949

    PeterPichler
    Participant

    Hi support team !

    First of all your form is working fine, nice code. But anyway, for the below problem I need your help:

    File: process.php

    This code works OK:
    $email = new Quform_Element(’email’,’email’);
    $email->addFilter(‘trim’);
    $email->addValidator(‘required’);
    $form->addElement($email);

    Thic code causes the problem:
    $email = new Quform_Element(’email’,’email’);
    $email->addFilter(‘trim’);
    $email->addValidator(‘required’);
    $email->addValidator(’email’);
    $form->addElement($email);

    So, adding a 2nd validator shows the following line in the error.log:
    “PHP Fatal error: Uncaught Error: Call to a member function addValidators() on null in /www/htdocs/…./quform/process.php:211
    Stack trace:
    #0 {main}
    thrown in /www/htdocs/…/quform/process.php:211

    Of course, process.php:211 is the line where the 2nd validator is located.
    The problem disappears immediately, when i delete one of the two validators (it does not matter which one) and constantly reappaers when I add the second validator again.

    Any ideas how to fix this curiosity ??

    Thanks
    Peter

    #29951

    PeterPichler
    Participant

    *** FINALLY GOT !T ***

    I had changed the error message in email.php to a german phrase, which included characters like (ä ö ü).
    These characters caused all the probelma, removing them made the contact-form working again.

    PS: It was intereresting to learn, that the form worked with ONE validator, even when the above characters were used. Only adding the 2nd validator caused the problem. But after replacing the “special” characters with “normal” characters, all probelms were gone, even with 2 validators activated.

    Greetings
    Peter

    #29962

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Be inspired. © 2019 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy