Pass Editor field name to function

Pass Editor field name to function

peterbrownepeterbrowne Posts: 314Questions: 54Answers: 0
edited August 2022 in Editor

I have a $.getJSON function used to populate a select list:

        var unit_groups = [];   
              
        $.getJSON("program_data/get_unit_groups.php", function(data) {
            var option = {};
            $.each(data, function(i,e) {
                option.label = e.text;
                option.value = e.id;
                unit_groups.push(option);
                option = {};
            });
        }).done(function(){editor.field('unit_group.unit_group_pk').update(unit_groups);
                          });

I now want to pass the value of an Editor field to that function. The field name is program_outcome.program_outcome

How would I do that?

Answers

  • rf1234rf1234 Posts: 2,991Questions: 87Answers: 421
    edited August 2022

    editor.val('program_outcome.program_outcome')

    Looks like Editor is a global variable in your code anyway. So no need to pass the field value.

Sign In or Register to comment.