How to duplicate a form-repeat row

I have a form-repeat inside my form where you can add lines for an invoice. I want to be able to duplicate a row with all its current input values without needing to save the current row beforehand. Is there a way to do this?

There is a duplicate function in Wappler that expects an index but when I duplicate that line is does’nt copy the values of the inputs.


Does anyone have any ideas?

Could anybody explain how to the the duplicate function of the form-repeat?

I haven't used this feature and not much seem to have been discussed. I did find this post however. How would I duplicate a row with inputs in them? Maybe it will make sense to you. HTH

@GraybeardCoder Thanks for your reply but I want to duplicate the inputs with their current values.

I am already able to duplacate the inputs but their value is reset to the default value

I haven't used the formRepeat duplicate action...

I suppose you can add a button that calls a page flow.
Inside the page flow create a repeat and dublicate the inputs with their values

I you talk about a single row dupliacate, then you pass the $index of the row you want to duplicate in your page flow (as a $param) and then in your page flow you copy the value of the current row input and create a new row and paste this value in there.

By the way, I just tested formRepeat duplicate action...
dublicate is doing exactly what you want
You just need:

  1. to have a button in each formrepeat row to trigger the duplicate
  2. pass the $index to the duplicate
    And you're done
    The duplicated row is added right after the row that triggered the action

@famousmag Thanks for your reply.

Your first solution could be something worth looking into, but I tested with your second solution and I figured out why it's not working for me.
The rows I am trying to duplicate have a few conditional regions in them and that prevents the values of the inputs te be copied.

Does anyone know how to solve that? Otherwise I will try your first solution and create an app-flow

On click event , check if the condition is teue and then duplicate the formrepeat row

You can include the duplicate button also in a conditional region (same condition) so it's not rendered if false

If you have problem setting it because of the conditional region, remove the conditional region, set the duplicate formrepeat row and then set again the conditional region...