How to switch an editor field's field type based on other field selection?

How to switch an editor field's field type based on other field selection?

zmartin875zmartin875 Posts: 2Questions: 2Answers: 0
edited October 2015 in Free community support

My scenario is I'm trying to dynamically change an editor field's field type based on another field selection. I have two fields: field name and field value. Field name is a select dropdown and field value is initially initialized as a text field. Based on the field name selection I may need to change the value field type from text to another type such as date, checkbox, etc. How is this best accomplished? I've tried using the dependent option on the field name field and clearing out the editor for the value field and the re-adding the value field using the add method with the new field type I need however that does not appear to work. Where is the best place to attempt this type of dynamic field type change?

Answers

  • allanallan Posts: 63,754Questions: 1Answers: 10,509 Site admin

    Hi,

    Editor's fields cannot currently have their type changed after initialisation. What you could do though is to remove the existing field (clear()) and then add a new one with the required type (add()).

    Allan

This discussion has been closed.