Is it possible to use variable.value to setValue() on:click action

I have a button that I need to make dynamic and I have two questions.

  1. Can I use variable_name.value to setValue() such as variable_name.value.setValue()? (starting to think I can’t)
  2. If it is possible what is the correct syntax?

Basically I have the below on:click action (which works) on a button and I have a variable (var_contact_target) that gets set to a value of ‘modal_detail_inspection.form_detail_inspection.inp_agreed_to_by’ when another button is clicked.

dmx- on:click=“modal_detail_inspection.form_detail_inspection.inp_agreed_to_by.setValue(contact_id);modal_ detail_inspection.form_detail_inspection.inp_agreed_to_by_text.setValue(Contact_Name);modal_contacts.hide()”

My instinct was to do:

on:click=“var_contact_target.value.setValue(contact_id);var_contact_target.value+’_text’.setValue(Contact_Name);modal_contacts.hide()”

OR

on:click="{{var_contact_target.value}}.setValue(contact_id);{{var_contact_target.value}}+’_text’.setValue(Contact_Name);modal_contacts.hide()"

Neither var_contact_target.value nor {{var_contact_target.value}} get replaced with the value.

I know the variable is set correctly because I can put {{var_contact_target.value}} in the button label/html and it displays correctly in the button label.

Is this possible? Seems like a variable’s value should be available for use like this in dynamic events. Hopefully I’m missing something simple.

Thanks in advance.

Community Page
Last updated: