Can I get actual field options?

Can I get actual field options?

klymov.inekonklymov.inekon Posts: 35Questions: 9Answers: 0

Hello. I need to get actual field options when serverside?
I've try something like this

editor.field('type').options();

I didn't find something like this in api or in field instance in devtools.
It can be possible only on event init.dt?

Answers

  • allanallan Posts: 65,254Questions: 1Answers: 10,816 Site admin

    Could you clarify a little what you are looking for please? Do you mean you need the list of options for a field on the server-side so you can do some kind of processing on them before they are sent to the client-side, or is it something else? If it is, what processing do you need to do, there might be another option such as using a renderer.

    Allan

  • klymov.inekonklymov.inekon Posts: 35Questions: 9Answers: 0

    Yes, after initialization, I would like to receive options for a specified field name. something like this

    var typeOptions = editor.field('type').getOptions();
    
    
    

    And receive all options for field with name "type" that were received after server side request.

    typeOptions = [
      {value: "type1", label :"type 1 label"},
      {value: "type2", label: "type 2 label"},
      ... 
    ]
    
  • allanallan Posts: 65,254Questions: 1Answers: 10,816 Site admin

    There isn't really an API for that I'm afraid - it is all baked into the ->process() method. What do you want to do with the data on the server-side? There might be another way of doing it.

    Allan

Sign In or Register to comment.