Hi Team,
I would like to create a search bar with dynamic propositions.
Someone know how to do under Laserfiche Form?
Thanks in advance.
Regards
Hi Team,
I would like to create a search bar with dynamic propositions.
Someone know how to do under Laserfiche Form?
Thanks in advance.
Regards
It depends on how you have everything configured, but something similar is possible with the built-in functionality.
If you have a database table that contains all of the possible "suggestions" then you can set the Single Line field to use that table/column as a Lookup and remove the "When" condition; this will retrieve all of the rows, and it will not auto-populate the field (unless there is only one row in the table).
With that configuration, it will pull all of the possible options from that column in the database table, and as the person types it will narrow the list to anything containing the letter combination in the field.
The only catch is that it matches across entire words, not just the beginning.
For example,
If your table has the following options
Typing "e" will narrow it down to
Typing "ra" will narrow it down to
Typing "an" will narrow it down to
And so on
Hi Jason,
Thank you very. I'm going to try.
It's working. Thank you very much.
But the user can write a word outside from the list ; how can I check if this word is in my list?
"eet" is in my list
"eer" is not in my list. The user should not submit the form.
If you want to make it so the have to choose something from your list and still allow them to type, then you'll need to do the following:
You can do this many different ways, but my preferred method is to create a Custom Validator and assign it to the field they are typing into; you can find an example of the custom validation here.
The example shows how to prevent duplicate entries, but you can replace the validation function with one that searches for the typed value in the dropdown and returns true/false (found/not found).
The reason I recommend the custom validator is that it will prevent form submission if it marks the field as invalid. Any other approach would require additional steps to stop the user from submitting the form with an invalid entry in the field.
Hi Jason,
I'm not pretty good with javascript. I'm trying to decrypte the code but I dont really understand.