Home › Forums › Quform PHP › Changing Regex to include hyphens
- This topic has 4 replies, 2 voices, and was last updated 10 years, 6 months ago by Tagtom.
- AuthorPosts
- May 16, 2014 at 9:13 am #10602TagtomParticipant
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);
May 16, 2014 at 10:51 am #10604AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 20, 2014 at 12:04 pm #10888TagtomParticipantHi 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
May 21, 2014 at 10:27 am #10979AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 22, 2014 at 9:48 am #11009TagtomParticipantHi 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
- AuthorPosts
- You must be logged in to reply to this topic.