Search

Hi there, I think this should be easy...

I'm trying to create a very simple spam test to see if the person submitting an event is a human.

What I want to do is create an input field in my section that has a validation rule that simple matches the word 'yellow'. On the front end the field will just ask 'What colour are daffodils'.

I'm using this expression in the validation rule: ^yellow$

Which I think should work but it doesn't - it seems to work in the Regex Tester but not on my site.

You are awesome already.

It seems you forgot the regex delimiters. Try using /^yellow$/i (i for case insensitivity).

It should work. Maybe you need to add delimiters either end? I am using this on a 2.1.2 site on a text input field (Terms and Conditions) which allows for a required checkbox on the frontend.

/^yes$/i

Touché!

Ah! Thanks. I should have said I know nothing about Regular Expressions so I was basing my 'should work' from a bunch of badly written articles I'd read over the past hour and a half.

Case insensitivity sounds good to me.

Thanks again.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details