Editor how to create dynamically a list of elements for field of type "select"

Editor how to create dynamically a list of elements for field of type "select"

djdecksdjdecks Posts: 1Questions: 1Answers: 0

So i want to dynamically generate list of elements for "select" field. I want to send values for elements in json via POST method.
How can i read data from url like this : http://ocalhost:8080/Test/getByPost which return json for example {"name":"test", "name":"test2"} . And after when i read this data, how can i put this values into field which is type of "select". Any idea ?

Answers

  • allanallan Posts: 40,558Questions: 1Answers: 4,957 Site admin

    The update method of the update field type is the way to do this.

    For example you might:

    $.getJSON( url, function ( json ) {
      editor.field( 'myField' ).update( json );
    } );
    

    Allan

Sign In or Register to comment.