Home › Forums › Quform PHP › Fatal Error when adding a 2nd Validator in process.php
- This topic has 2 replies, 2 voices, and was last updated 5 years, 2 months ago by Ally.
- AuthorPosts
- September 15, 2019 at 9:14 pm #29949PeterPichlerParticipant
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:211Of 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
PeterSeptember 16, 2019 at 6:58 pm #29951PeterPichlerParticipant*** 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
PeterSeptember 19, 2019 at 9:44 am #29962AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.