Changing Regex to include hyphens

Home Forums Quform PHP Changing Regex to include hyphens

This topic is: resolved
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10602
    Tagtom
    Participant

    Hello,

    I would like my quform first and last name input fields to allow hypens, in addition to alphanumeric characters. I believe it is necessary to update the regex filter (below) found on process-filtersphp, but not sure 100%.
    Thanks in advance for your help,

    Stephan


    /**
    * Configure the regex filtered field
    * Filters: Regex
    * Validators: Required
    */
    $regexElement = new Quform_Element('regex_filter');
    $regexElement->addValidator('required');
    $regexElement->addFilter('regex', array('pattern' => '/[\d+]/'));
    $form->addElement($regexElement);

    #10604
    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.

    #10888
    Tagtom
    Participant

    Hi Ally,
    Thanks for your quick response. Yes, I do want change the validator and not the filter. Where should I put this line of code? I’m afraid I’m not an expert in PHP.

    Thanks again,

    Stephan

    #10979
    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.

    #11009
    Tagtom
    Participant

    Hi Ally,

    Worked like a charm! (I had to remove the “alphanumeric” and “digits” validators, but that would probably be obvious for the PHP programmers that might be reading this…).

    Best regards and many thanks,

    Stephan

Viewing 5 posts - 1 through 5 (of 5 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