I m looking at adding a custom field It
# avo-2
a
I'm looking at adding a custom field. It's a visual editor for workflows that accepts and outputs JSON, currently fully functional in a Stimulus controller. I'd like to be able to tie into the form submit so I can get the latest JSON out of the editor and put it into the field contents. Is there anything in place to let me do this?
Right now it works in a Resource tool just fine:

https://cdn.discordapp.com/attachments/1130623400482705450/1130623568267448320/image.png

But right now I have to click 'Save Workflow' which calls a stimulus method to update the hidden form field containing the JSON data directly in the DOM, then I have to click 'Save' to save the record
Maybe it's best to keep it in a resource tool though? And if so, can I tie into the 'submit' event for the form?
l
You can have it bith as a field or as a resource tool. Semantically they are both nested inside the form when the user plays around with it
The issue, it seems, is that the js plugin (the visual editor) does not auto-update the field once the user does something to it
Thise plugins should have some sort of callback for that kind of thing
Would you be interested in creating a standard field from that?
a
I can hook into a bunch of lifecycle events, and update the text field when that happens. It's just simpler to call it once when the button is clicked. Either way is doable, just one event vs ten or so. The editor is Drawflow: https://github.com/jerosoler/Drawflow