Form is rendering before data submission is ready
I'm using formio with Angular,
Then I'm creating a form with a component that in advanced logic as javascript trigger condition that uses a var owner = data.OWNER; that depends on data.
When the form is created in angular with Formio.createForm( document.getElementById('formio'), this.form, options, ).then((form) => { form.submission = this.formioSubmission; }
The data arrives if i display a console.log but the console log prints multiple times undefined before gettings its value since the form is being rendered and the data is then loaded at the submission so the owner = data.OWNER; executes before the data is available.
Is there a better approach to use the data of the form or to wait until the form is rendered or is it a bug?
Version/Branch Formiojs: 4.21.4 Formio/angular: 7.0.0
Expected behavior Getting the data values before JavaScript in logic trigger is loaded.
I've found workaround for this, you can use evalContext property for configuration, and pass via it anything you want to be available for form in runtime.
In this scenario u can pass
evalContext: { initData: someData }
and then you can use initData like for exmaple data for custom default value
maybe that will suits for you
I've found workaround for this, you can use evalContext property for configuration, and pass via it anything you want to be available for form in runtime.
In this scenario u can pass
evalContext: { initData: someData }
and then you can use initData like for exmaple data for custom default value
maybe that will suits for you
I've already tried this method but it won't fully work since it won't validate in the backend when the data is sent to nodejs
ahh, so good luck with finding other way :/
Can you provide a jsfiddle or some sort of code sandbox to illustrate what you are trying to do?
This is a duplicate of https://github.com/formio/formio.js/issues/3687