Referring to a specific input in a repeat

Hi,

Is there a way to change the value and text of a specific input in a repeat?

My use case is: I have a form input in a repeat, where I want the value of the form input to be set via clicking a button. Clicking the button will result in a modal pop-up, allowing the user to select a value from a table. The intended functionality is to then populate the input with the value that the user selected.

Is there a way to do this? I’ve managed to set everything else up (modal, table, selecting the data, etc) but am struggling with changing the input as it is in a repeat.

I tested it on an input not in a repeat and that works fine. I’ve tried using a dynamic event on button click to reference the input within the repeat using syntax like “repeat[index].input.setvalue(x)” and also tried to use JavaScript but couldn’t find a way that worked.

Thanks in advance!

Hi.
Try something like repeat1.items[index].input1.setValue(...)

Thanks @sid! Sorry, that is what I meant to write. See the code below (the code for the input in the repeat highlighted in green doesn’t work, the code for the input not in the repeat highlighted in blue does work):

Don’t see any reason why the code wouldn’t work, as you have written it.
We have used similar expression in past, and it works fine.
Maybe you have some form or collapse or some other component here, so you might need to do items[0].collapse1.input1.setValue,

You can also try to run this expression in browser console to double check the element path.

Thanks @sid. There is nothing else inbetween the input and the form except for columns/rows/formgroups divs. It’s really puzzling me… I tried running an expression in console as you suggested, but it seems to not recognise the “items” part of my expression - see screenshot below:

Anyone else who might have experienced this problem before?

Hey, I finally managed to solve it by setting a value using custom Javascript. However, I am still curious to know why setting the value using dmx onclick doesn’t work… as that would be my preferred solution still.