Home › Forums › Quform PHP › Translation of several validators
- This topic has 1 reply, 2 voices, and was last updated 7 years ago by Ally.
- AuthorPosts
- November 9, 2017 at 2:27 pm #22972millepilleParticipant
Hi,
I try to translate several validators:/**
* Configure the first name element
* Filters: Trim
* Validators: Required, StringLength min 1 max 150
*/
$name = new Quform_Element(‘name’, ‘Name’);
$name->addValidator(‘required’, array(
‘messages’ => array(‘required’ => ‘Geben Sie Ihren Namen ein.’)
));
$name->addValidator(‘stringLength’, array(
‘min’ => 1,
‘max’ => 150,
‘messages’ => array(
‘invalid’ => ‘Geben Sie eine Zeichenfolge ein.’,
‘too_short’ => ‘Ihre Eingabe muss mindestens %1$d Zeichen enthalten.’,
‘too_long’ => ‘Ihre Eingabe darf nur %1$d Zeichen enthalten.’
)
));
$name->addFilter(‘trim’);
$form->addElement($name);/**
* Configure the email address element
* Filters: Trim
* Validators: Required, Email, StringLength min 1 max 50
*/
$email = new Quform_Element(’email’, ‘E-Mail Adresse’);
$email->addValidator(‘required’, array(
‘messages’ => array(‘required’ => ‘Geben Sie Ihre E-Mail ein.’)
));
$email->addValidator(’email’, array(
‘messages’ => array(‘invalid’ => ‘Das ist keine gültige E-Mail.’)
));
$email->addValidator(‘stringLength’, array(
‘min’ => 1,
‘max’ => 150,
‘messages’ => array(
‘invalid’ => ‘Geben Sie eine Zeichenfolge ein.’,
‘too_short’ => ‘Ihre Eingabe muss mindestens %1$d Zeichen enthalten.’,
‘too_long’ => ‘Ihre Eingabe darf nur %1$d Zeichen enthalten.’
)
));
$email->addFilter(‘trim’);
$form->addElement($email);The first version for “name” works, how do I get the same for required, email and StringLength?
Thank you for the great support
November 12, 2017 at 1:18 pm #23049AllySupport 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.