How To Use a Form Within a Repeat Region

I have a data type lookups with lots of user defined values that then appear within dropdowns in my app. I’m creating an environment where the user can manage these.

So an example of some lookup values would be:

type       value
==================
gender   male
gender   female
gender   transexual
region   north
region   south
region   east
region   west

I’m thinking about this kind of structure, where I just list the lookup values within a form and an input in a repeat region:

<button ADD GENDER>
<repeat get_lookups.data.lookups.where(type=='gender')>
   <form update_lookup>
      <input lookup_name>
      <submit button>
   </form>
</repeat>

Can I put a form within a repeat, or will this not work?

If not, should it work with a Server Connect to a get server action?

Best wishes,
Antony.

as it repeats you will get errors because the form names are the same. So what you need to do is add $index to the end of form names. so as it repeats the variables also change by adding the index to the name

Thanks for that @baub!

Can you tell me the syntax in the id field to do that please?

Thanks!

Antony.

I think I maybe I answered this wrong. Are you just looking to create dynamic dropdowns in select statements?

https://community.wappler.io/t/dynamic-select-menu/2867

No, I’m looking to create an interface to add/edit/delete the values that can appear in such a dropdown…

what about just having a table in the database that you pull from. Then just have insert/update scripts to change the values? Or am I missing something?

table called gender with the 3 values as data?
table called region with 4 values as data?

Maybe I’m missing what you are trying to do?

I’ve tried my own suggestion using a form and Post Server Action, and it works! :slight_smile: