formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

custom action of button component doesn't change data

Open amirmf opened this issue 8 years ago • 3 comments

when i use button component with custom action with this code: data.myFieldName = "100"; when i click on the button it doesn't change the field's data

i thinks this should be a bug

same code works on ngFormio (angular based form renderer)

amirmf avatar Aug 07 '18 11:08 amirmf

Hello Amir,

William here with the Form.io support team. Great to hear from you!

It is not expected to populate data using the button component. Component controls its own value.

The best way to do this is to either:

  1. Have myFieldName be a calculated value or
  2. Set the button to trigger a custom event and then use the Logic tab on the component to listen for the event and set its value.

Let me know if you have any further questions or concerns.

Thanks,

William Gay

wag110894 avatar Aug 08 '18 18:08 wag110894

Hi William,

thanks for your response. ok i will do that. but in your previous versions i could use the button component to change the other fields data. i think it has changed in latest version.

Thanks, Amir

amirmf avatar Aug 10 '18 06:08 amirmf

Hello Amir,

William here with the Form.io support team. Great to hear from you!

It is not expected to populate data using the button component. Component controls its own value.

The best way to do this is to either:

  1. Have myFieldName be a calculated value or
  2. Set the button to trigger a custom event and then use the Logic tab on the component to listen for the event and set its value.

Let me know if you have any further questions or concerns.

Thanks,

William Gay

Hi @wag110894 ,

When you create a button with "Custom Logic" the default placeholder text seems to suggest you can update data field from a button. Has there bee any changes since you responded to this issue?

image

AnthonyPhan avatar Nov 24 '21 14:11 AnthonyPhan