Form Repeat (make sure of unique inputs only)

Just want to get some ideas of what possible solutions others may have.

So i have a form repeat element on my form, inside it is a select dropdown with 3 different choices.
The dropdown in populated from another database query all together.

Currently the user could add all 3 to their list of choices and choose the same item all 3 times, and it would create 3 identical entries inside the sub table.


As you can see Kayak Guide has been added twice by mistake.

I see 3 possible solutions.

  1. it would be awesome if after the user chooses Kayak Guide, then that choice is no longer available in their next dropdown, kind of like how tagify works, where once an option is chosen, its not available again. I did not use tagify for this UI as there is a hidden input that stores a priority as well, that is important for me to know.

  2. On submit of the form, the server action strips out the duplicate values and only sends unique ones to the insert, i have tried using the groupby fillter, but can not seem to get it to do exactly what i want, i also tried the unique formatter but then i loose my priority input, so neither really give me a subtable insert with only 2 unique entries with their set priority which is just the $index of the form repeat.

  3. Before submit, a client side validator checks and warns of duplicate values, like a NOT Equal / In Array validation.

Anyone got some better plans on how to best do this, maybe there is a way i could also use tagify but have it return the value of the chosen tag as well as its position in the array as its priority, even though i do not think it would be a very intuitive user UI.

Even the documentations example, where there is a USER / Contacts table relationship and standard text inputs, a user could enter multiple contacts with duplicate email addresses, and because of the way it inserts into the subtable, i do not see a way to add a validate step or something before each insert, so maybe i am missing something

Hi psweb,

As far as I understand, you have a form repeat containing an input select and a button that adds more selects in your form (up to 3 selects) .
First thought:
Can you use the select’s on_update event to check if this value has been used already.
Right way:
Where are the 3 choices of the selects coming from?
I suppose there must be a way to restrict the select’s source and exclude the already used values so the drop down shows only the remaining ones.

I kind of tried that already, but if i remove the selectedValue from the dataset then even the select which has been chosen removes its selection as all 3 selects use the same data source to the server connect database

The add button which is outside the repeat element will add as many new selects as the item count of the database query which is used as the source, so it could be only be 1 in some cases or it could be 50 in theory.

I am going to try use the items inside the formRepeat itself possibly as a way to filter the data sources as my next attempt.

What about using the Tagify and running an Event after each is selected to update your hidden input?

Will give it a try and let you know if it works out. Thanks

Hey Paul,

Hope you are fine!
I just came across the same situation today and solved it using a client side array. Works like a charm.

Just wondering is there any other way? How did you solve it buddy?

Hi @famousmag,

I have come across the same situation where I want to remove the values that have been already selected in a form repeat. I’m using Tagify instead of select in the form repeat.

I have been unable to get this working with various methods I have tried. How did you solve this with the client-side array? Could you please provide some information on this setup? Your help is greatly appreciated.

Hey @guptast,

Of course buddy!

First it would be nice to know what we are talking about…
This is for an Update or an Insert? I mean the form repeat comes already with ome saved values form a datasourse or you just start form scratch adding values via your tagify?
And your tagify I suppose it is a select one (only one value is acceprable)
Anyway the idea (IN MY CASE) was to add each selected value in an array AFTER I check on change event if that value is not already used…


This is from the select update event…
If you got it is fine!
If not give me an hour to be at office and help you solve your exact case

1 Like

Hi @famousmag,

Thank you for the screenshot!

The Tagify input in the formRepeat is already getting its values from the datasource. The tagify mode is set to select.

I will try setting up an array and inline flow as shown in your screenshot and let you know.

Thanks again for your help!

1 Like

OK, I’m here for anything you might need buddy
Here is a wider view…

In case of an update it means that you have first to fill up the array with the existing values, obviously on the success event of the source of your record datasourse (not the tagify datasourse…)
If I knew what we are talking bout exactly I could give more details

1 Like

Hi @famousmag,

I have got it working. The formRepeat is for an insert and the tagify values (list available to the users) are being added to the form based on the user selection. Here’s a screenshot of the setup (with Tagify - Select Mode).

Many thanks for your help. I had been trying to find a method to achieve this and your solution worked perfectly :slightly_smiling_face:

1 Like

Glad it worked buddy!!
Anytime!!

1 Like