formio / formio.js

JavaScript powered Forms with JSON Form Builder

Home Page:https://formio.github.io/formio.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Calculate Value not working when Allow Manual Override of Calculated Value is selected.

TusharGoel14 opened this issue · comments

Environment

Please provide the details on the working of the same.
If we add a logic to get value in calculated value and click on Allow Manual Override of Calculated Value then values are not getting set as per the logic.

image

image

image

No values added in Text Area
image

Steps to reproduce

  1. Create the text field and enable Multiple Values and save.
  2. Create the Text Area, enable Multiple Values, in Calculate Value add value = data.textField , select the Allow Manual Override of Calculated Value and Save
  3. In the Renderer add the values in textField

Expected Behaviour

Values added in textField should be added in textArea along with Manual values we are adding in textArea

Observed Behaviour

Values added in textField are not added in textArea though we can manually add the values

Example

For code or form JSON, please enclose in a code block:

{
  "display": "form",
  "components": [
    {
      "label": "textField",
      "applyMaskOn": "change",
      "tableView": true,
      "multiple": true,
      "defaultValue": [
        ""
      ],
      "key": "textField",
      "type": "textfield",
      "input": true
    },
    {
      "label": "Text Area",
      "applyMaskOn": "change",
      "autoExpand": false,
      "tableView": true,
      "multiple": true,
      "calculateValue": "value = data.textField",
      "allowCalculateOverride": true,
      "key": "textArea",
      "type": "textarea",
      "input": true
    },
    {
      "type": "button",
      "label": "Submit",
      "key": "submit",
      "disableOnInvalid": true,
      "input": true,
      "tableView": false
    }
  ]
}

Note

This behavior is only observed when Allow Manual Override of Calculated Value is enabled and component have multiple values enabled.
In both the cases Allow Manual Override of Calculated Value is enabled

  1. Case 1
  • textField : Multiple Values not enabled
  • textArea : Multiple Values Enabled
  • Observation : Value added in text field populated in textArea and we can add values manually also.
  1. Case 2
  • textField : Multiple Values Enabled
  • textArea : Multiple Values Enabled
  • Observation : Value added in text field not populated in textArea, we can add values manually in textArea