Update content input fields by JS

Hi,

is it possible to set values to the content input fields via JS?

In my scenario: When value of field A changes, then field B should get value X.

Hi @Detzler, and thank you for contacting Builder.io Forum!

Yes, it is possible to set values to the content input fields via JS. This can be done using the state in the builder. Please refer to this doc for more details: Making interactive content in Builder.io with state and actions - Builder.io

Here are some instructions and loom for your scenario:-

  1. Create two input fields for say with the name newField0 and newField1.
  2. Set the value of field0 by going to Custom JS in Data Tab and setting the state.newField0 = {dynamic or static value};
  3. Select the field0 and add action change in Data Tab, and set the state to another field1. In this way when field A changes then B gets the desired value.

Loom: Loom | Free Screen & Video Recording Software | Loom

Let us know if you have further questions!