Translation of several validators

Home Forums Quform PHP Translation of several validators

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22972
    millepille
    Participant

    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

    #23049
    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 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy