You are viewing limited content. For full access, please sign in.

Question

Question

Forms regular expression True or False without being in radio or drop down button

asked on February 17, 2022

I would like to use a single field for a True or False answer on a form, but the user must enter True or False, not in a radio button, checkbox, or dropdown field because it is going to prefill from a database, but I want the user to be able to change the value from True to False or from False to True.  With a drop-down, I can have it prefill, but I cannot change it.

 

Could I do this with a Regular Expression and only allow the values "True" or "False"  And if so, how do I write that?

1 0

Answer

SELECTED ANSWER
replied on February 17, 2022

Got it!

 

In Regular Expression field I added (True|true|False|false).

1 0
replied on February 18, 2022

I’m not where I can access my system, but I believe I did similar to your solution and later discovered that staff could add extra characters and the system would accept it.  So you might want to test it with a valid response and then add extra text to the beginning and/or end to see if it still accepts it as valid.

If I’m right, then you can probably resolve it with start and end string anchors, like this:

^True$|^true$|^False$|^false$

 

1 0
replied on February 18, 2022

Thank you.  I will check that out too.

1 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.