Closed domichal closed 4 months ago
valueProperty
Fields being populated AND default value is set correctly
With valueProperty set I have no access to the component data so related fields can't be populated
https://jsfiddle.net/domichal/snm1g2hd/
For code or form JSON, please enclose in a code block:
const form = { "display": "form", "components": [ { "label": "Pick something", "widget": "choicesjs", "tableView": true, "dataSrc": "url", "data": { "url": "https://examples.form.io/customer/submission" }, "template": "<span>{{item.data.firstName}}, {{item.data.lastName}}</span>", "validate": { "select": false }, "key": "selector", "logic": [ { "name": "updateFields", "trigger": { "type": "event", "event": "change" }, "actions": [ { "name": "updateFieldsAction", "type": "customAction", "customAction": "submission.data.firstname=value.data.firstName;submission.data.lastname=value.data.lastName;submission.data.email=value.data.email" } ] } ], "type": "select", "searchField": "", /* "valueProperty": "data.email", */ "limit": 20, "input": true, "lazyLoad": true, "selectValues": "", "disableLimit": false }, { "label": "name", "tableView": false, "redrawOn": "selector", "allowCalculateOverride": true, "key": "firstname", "type": "textfield", "input": true }, { "label": "last name", "tableView": false, "redrawOn": "selector", "allowCalculateOverride": true, "key": "lastname", "type": "textfield", "input": true }, { "label": "email", "tableView": false, "redrawOn": "selector", "allowCalculateOverride": true, "key": "email", "type": "textarea", "input": true } ] } Formio.createForm(document.getElementById('formio'), form).then(function(form) { // Defaults are provided as follows. form.submission = { data: { selector: 'joe@example.com' } }; });
Here's a new JsFiddle that I believe should resolve the issue you're dealing with. https://jsfiddle.net/cs197pqt/
Environment
Steps to Reproduce
valueProperty
line (:35)Expected behavior
Fields being populated AND default value is set correctly
Observed behavior
With
valueProperty
set I have no access to the component data so related fields can't be populatedExample
https://jsfiddle.net/domichal/snm1g2hd/
For code or form JSON, please enclose in a code block: