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

Question

Question

How can I make a Lookup field require that the value be one of the values from the data source?

asked on April 6, 2016

I have a Single Line text field with a simple lookup rule. It "fills" the field with all of the possible data values from the database. The way it behaves is a user starts typing in to the field, and it suggests various possibilities from the database as they continue to type. This works great.

What I want to do is make it so that the field pops an error message, unless the user fills the field with a value that came from that database. There are 10s of 1000s of possible values, so a Drop Down menu is not a reasonable option here.

Is there some mechanism I could use through JQuery or otherwise, that will allow me to prevent submission of the form *and* pop an error message if the value entered in to the field doesn't match one of the suggested values from the database?

 

 

0 0

Replies

replied on April 7, 2016

Hi Gareth,

The way I aproached this was to have a lookup rule fill a hidden field woth all of the values then used jquery to compare the contents of a user-editable field with the values in the hidden field.

There are a number of ways to use JQuery to prevent submission of the form. One method is to make the submit button "disabled" until the user-editable field contains a valid value.

-Ben

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.