Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Hello,
I want to retrieve and set form data from within the BeanShell plugin. How can I do this? I found an old article in the v2 knowledgebase that refers to a FormManager class, however this class doesn't seem to exist anymore in the v3.
Thanks in advance,
Andrew
4 Comments
Owen Ong
Hi Andrew,
You can use the API exist in AppService.
Hope this helps.
Best regards.
Andrew Whalen
Hi Owen,
This looks good! The only question I have left however is is there a method to return the names and types of the form fields? In other words, I have a piece of code that works generically on all forms and I won't know in advance which fields are available in a form. I found the following method on the Form class that appears to do the trick but I just wanted to confirm:
Form.getFormMetas()
Will this method return a map of all the fields and their types?
Thanks!
Owen Ong
Hi Andrew,
Form.getFormMetas() is used for passing some internal parameters which will be render as hidden field when rendering the form.
To get the all the Columns in a form data table, you can refer to the implementation of the getColumns() methods of FormRowDataListBinder.
Hope this helps. :)
Best regards.
Andrew Whalen
Thanks Owen!
Ok, got it. So I use the AppService API to get my form, and then I can use the code in getColumns() as an example of how to retrieve the form field names.
Cheers!