FormRepeat Data Access in Flow

Wappler Version : 5.8.2
Operating System : Windows
Server Model: NodeJS

I am attempting to access FormRepeat items outside of the form-repeat. For example, in my use case I am trying to save changed data of the form repeat via flow action inside a datastore.

Using the dynamic data picker in the Wappler UI results in ‘formrepeat.input_name.value’ being picked as value. I have also experimented using ‘formrepeat[0].input_name.value’ and formrepeat.items[0].input_name.value’ to see whether the data is accessible at all.

Expected behavior

Using the dynamic data picker and/or one of the variations mentioned above should allow me to access and output the data inside the formrepeat item.

Actual behavior

The data is not accessed properly. Storing it inside a data store will result in the fields being empty.


According to these threads, it should have been possible to do so since Wappler version 5.0.2:


It seems I am not the only one encountering this, as there are previous mentions of people not being able to access form repeat data as desired:

Bump

Bump

Hey @jay_savvi,

Please paste here your code of your form-repeat and screenshots of your flow to check it.

1 Like

Thanks for your reply. It seems the issue occurs, when a Form-Repeat is used without it being encapsulated in a Form. I still run into the issue when simply using the ‘repeat’ (which seems to be the more accurate class since the form isn’t used as such) instead of the form repeat.

This is the flow:

<script is="dmx-flow" id="flow_question_text" type="text/dmx-flow">{

  alert: {message: "{{'Text is: '+questions[0].question_text}}"}

}</script>

This is the repeat:

<div class="row w-75" is="dmx-repeat" id="questions" dmx-bind:repeat="api_question_list.data" key="$index">
    <input id="input_question_text" name="question_text" type="text" class="form-control" dmx-bind:value="question_text">
</div>

How/where is the flow triggered?

Using a button with dmx-on:click outside of the repeat like this:

<button id="btn1" class="btn" dmx-on:click="flow_question_text.run()">Button</button>

Which triggers the alert, but without the question_text.

You lost me or I don’t understand…

Since you’re triggering the flow outside the repeat how the flow is going to know what is the questions[0].question_text ?

  1. You must pass a parameter to your Flow:

  2. Now as long as you know which value you want to pass to the Flow you call it:

You already know which value is passed by clicking the button or we have to find a way to accomplish that?
Can you just include the button inside the repat (with the input question_text so toy know by the $index its value?

I hope you following me

1 Like

Thank you for your reply! Yes, the example use case doesn’t make much sense, since I only created that for demonstration/debugging purposes.

In my actual use case, I have multiple input fields inside my repeat region, and I want to access that data using a flow without having to manually pass each field as a parameter. I would theoretically want to pass the $index value to the flow, so I know which repeat to access, but for testing purposes, I tried to access the repeat with index = 0, just to see whether the access works in general in order to circumvent possible problems when trying to pass an index value dynamically.

So, please explain me, what exactly this button does and why it has to be outside the repeat…

As a matter of fact, please tell us what you want to archive so we follow along.
You talked about datastote… What is the final concept?
Updating each record(line) of your repeat directly?

1 Like

The button doesn’t have to be outside of the repeat; it just happened to be for testing purposes. The issue is that accessing the input fields outside of the repeat does not appear to work.

1 Like

ok

So, it works as I told you already in my previous post…

  1. add a parameter in your flow
  2. included the button inside the repeat and on button click event run the floe and pass the input field you need