Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Under the 'Choose Options Data Store' menu, click on 'Bean Shell Form Data Store' in the Options Data Store select field.
Under 'Configure Bean Shell Form Data Store', enter your Bean shell script to populate the select fields. For each row that you add to the FormRowSet, be sure to put the 'FormUtil.PROPERTY_VALUE' and 'FormUtil.PROPERTY_LABEL' fields in the FormRow that will be added to the FormRowSet.
import org.joget.apps.form.model.*; import org.joget.apps.form.service.*; public FormRowSet test() { FormRowSet f = new FormRowSet(); f.setMultiRow(true); FormRow r1 = new FormRow(); r1.put(FormUtil.PROPERTY_VALUE, "test1"); r1.put(FormUtil.PROPERTY_LABEL, "tester1"); f.add(r1); FormRow r2 = new FormRow(); r2.put(FormUtil.PROPERTY_VALUE, "test2"); r2.put(FormUtil.PROPERTY_LABEL, "tester2"); f.add(r2); return f; } return test();
Of course, you would want to populate the values for PROPERTY_LABEL and PROPERTY_VALUE from your external datasource. For more information on how to connect to a database source, see the example code within 'Pre-populate Form Fields with Data from External Source' or this example on the Joget Blog.