I'm using form repeat to create new text input rows so users can create a list. No issue here. This list will become a select list with dropdown option items, shown on a different page on the website. I'd like to dynamically build the select list as a preview from the form repeat rows, on the same page. This would show users who are creating the list, what other users will see as a result. My users are not internet developers so it helps to show them what the results will look like. Anyway...
I've tried using a form repeat within the preview list select dropdown to create more option tags, but that won't work. Wappler won't even show the form repeat properties if it is inside a select tag. A regular "repeat" inside the select element also doesn't appear to make Wappler happy as no properties can be seen again.
Any suggestions on how to dynamically create/remove option tags when a row is added/deleted in a working form repeat?
Interesting solution @franse . I can see a preview button working to satisfy the use case. Using event listeners, I was trying to avoid that extra button press. Now I'm thinking aloud based on your thoughts...
What if each time a new row is added in the form repeat, the array gets updated? With the select data source pointing to the array, if I can reload the datasource with the same new row onclick, the select options might dynamically be added.
If you use a data store it's very easy. On the form repeat inputs as needed set the dynamic attribute 'input changed' to upsert into the data store (include an index field mapped to the formrepeat index). Then use the data store as the source for a tagify component in select mode.
I've never used form repeat before, and I'm trying to understand how it works with data stores in Wappler. Your approach sounds really interesting, especially since you mentioned handling a complex form dynamically.
Would you be able to share a practical example? A code snippet or an image would help a lot!
While I use the data stores, I don’t use form repeat as I wrote the app before Wappler had invented it!
I use one large repeat which has no forms, it just read and writes rows to the data stores. Then I have a huge hidden form which passes the data stores to a server action when someone checks out.
There are probably better ways to do this now using form repeat but I’ve never used them!