Hi everyone,
I have a form where I have a data-grid (DG) component inside and in that DG component I have a number and text field component , I want both of them to behave like if the user has written anything in those fields in the first row of the data-grid component I want the second row or any rows added of that same data-grid component to have the same values written in that number and text-field component.
Any suggestions would be helpful!
Thanks
This can be achieved by setting the default value of the Textfield and Number fields within your data grid.
Chance you data-grid to display a single row by default
Open the component settings for the textfield within the data grid and navigate to the data tab. Set the "Custom default value" setting to a JavaScript expression to sets the value to the value of the textfield on the first row of the data grid.
This is an example, however you will need to modify this to fit your specific form fields
value = data.dataGridRepeatingTable[0].textField
Repeat the above for the number field. The JavaScript should be very similar e.g.
value = data.dataGridRepeatingTable[0].number
Here is an example of the final outcome:
This can be achieved by setting the default value of the Textfield and Number fields within your data grid.
Chance you data-grid to display a single row by default
Open the component settings for the textfield within the data grid and navigate to the data tab. Set the "Custom default value" setting to a JavaScript expression to sets the value to the value of the textfield on the first row of the data grid.
This is an example, however you will need to modify this to fit your specific form fields
value = data.dataGridRepeatingTable[0].textField
Repeat the above for the number field. The JavaScript should be very similar e.g.
value = data.dataGridRepeatingTable[0].number
Here is an example of the final outcome: