How to set value of variable whose name is determinated at run-time?

Hello,

I need help setting the value of a variable whose name is determined at run-time:

<dmx-value dmx-bind:id="isModified_' + $index" dmx-bind:value="false"></dmx-value>

<input type="checkbox" dmx-on:changed="('isModified_' + $index).setValue(true)">

When the checkbox is ticked, the value of the variable should be updated. I don’t know how to do it :frowning:

P.S.: The $index is because this code is inside a repeater

Context:

I have a table populated through a dmx-repeat, and one of the columns contains a checkbox. If the user ticks the checkbox, I want to add a symbol/icon indicating the row has been updated (and therefore has pending changes to save)

Maybe this helps:

A single quotation mark is missing here
‘isModified_’ + $index

1 Like

Actually I found here an alternative solution, it seems I can use a static id and it’ll work ok:

No collision with variables with the same ID

Thanks for the help attempt, famousmag!

1 Like