Add fields to an existing field editor dynamically

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
I have a tab on which I have a number of field editors positioned in the way that the designer would like. For one of these editors I would like to add fields dynamically via a Javascript snippet.

All the postings I can find thus far refer to the dynamic creation of the entire field editor. I don't want to do that. I want to target a specific field editor and add fields to it.
Photo of Mick Starcevic

Mick Starcevic

  • 80 Points 75 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Mike Dwyer

Mike Dwyer, Champion

  • 4,736 Points 4k badge 2x thumb
What you may need to do is include ALL the potentially desired fields in the field editor and render them based on a javascript snippet returning true. Whatever conditions are tested by the javascript will return true for the fields you would "add" when those conditions exist.

You will probably need multiple snippets for each set of fields that share a common condition set, and conceivably one snippet for each conditional field.
Photo of Mick Starcevic

Mick Starcevic

  • 80 Points 75 badge 2x thumb
Hey Mike,

Thanks for your response. 

My problem is that the source table/model is dynamic in that users can add new records at any time. 
Photo of Bill McCullough

Bill McCullough, Champion

  • 13,612 Points 10k badge 2x thumb

I don't think there is any way to do this without creating a custom component (i.e. a field editor that you render dynamically).  Mike's suggestion would also work for what it seems that you are trying to achieve.

When a second record is added to a model and you are displaying the data in a field editor, Skuid will repeat the field editor.  I don't think that is what you want.  Would you give us a little more of your requirement.