formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

Item template changes for select component whenever the control is open in edit mode in builder [BUG]

Open pardeep224 opened this issue 7 years ago • 3 comments

Environment

Please provide as many details as you can:

  • Hosting type
    • [ ] Local deployment
      • Version: 4.2.6
  • Formio.js version: 4.2.6
  • Frontend framework: angular-formio
  • Browser: Google Chrome
  • Browser version: 77.0.3865.90 (Official Build) (64-bit)

Steps to Reproduce

  1. Take a select component on form.
  2. Set URL and set the field name in value property "param_id" and set item template value as "{{ item.param_name }}".
  3. click on save button.
  4. Change any value of select component from UI.

Expected behavior: Setting should be remain as it was done at the time of design.

Observed behavior: Property value field "param_id" is being set in item template as "{{ item.param_id }}" on the place of {{ item.param_name }}.

Example

NA Select1 Select2

pardeep224 avatar Oct 03 '19 13:10 pardeep224

This is a known item that we are trying to resolve. We have had a lot of people report it but haven't been able to reproduce it yet for some reason. Can you provide a form or more information on how to reproduce it?

randallknutson avatar Oct 03 '19 14:10 randallknutson

This is happening due to the below code in select.edit.data.js

onChange: function onChange(context) { var valueProp = context.instance.data.valueProperty; var templateProp = valueProp ? valueProp : 'data'; var template = "{{ item.".concat(templateProp, " }}"); var searchField = valueProp ? "".concat(valueProp, "__regex") : ''; context.instance.root.getComponent('template').setValue(template); context.instance.root.getComponent('searchField').setValue(searchField); }

template value is set to valueProp if it is present

sanjaykrgaur avatar Oct 14 '19 05:10 sanjaykrgaur

@sanjaykrgaur This should be resolved in v 4.4.2

jeriah-formio avatar Oct 21 '19 16:10 jeriah-formio