Is it possible to return value from ribbon tool bar button to simple text field?

StackOverflow https://stackoverflow.com/questions/10309622

  •  03-06-2021
  •  | 
  •  

Pregunta

I added a button to return the value from popup page to the RTF field. But my current requirement is to add the value to the simple text field. Can anyone please suggest me a way how can I return the value to the simple text field?

¿Fue útil?

Solución

Currently you can't do that in supported way because there are no API to get access to Field Builder control from the View. If you'll decide to workaround this (accessing private properties, some other hacks), you can achieve this by using Field Builder control API. For example:

var field = fieldBuilder.getFocusField(); // returns currently focused field object
field.getValues();  // returns field values (might be more than 1 in case of multivalue fields
field.setValues([...]); // sets field values

But be careful, that by clicking on the Ribbon Toolbar Button focus will be moved out from the field to the Ribbon Toolbar Button. So fieldBuilder.getFocusField() will return null. One of the possible solutions to listen for the "focusmove" event on Field Builder control to track focused fields.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top