Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Hi everybody,
I need some help. I am trying to fill a select box with data from native database. That is the scenario: I have a table with data about departments and i want to populate my select box with values from a column in this table.
I don't know how.
1 Comment
Usver
In the form builder you have to choose to your selectBox Options Binder: Bean Shell From Binder with text like this:
import org.joget.apps.form.model.*;
import org.joget.apps.form.service.*;
import java.sql.*;
import java.util.*;
Connection con = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/DBName?useUnicode=true&characterEncoding=UTF-8", "Username", "Userpass");
if(!con.isClosed()){
PreparedStatement stmt = con.prepareStatement("select name, email from view_Person");
ResultSet rs = stmt.executeQuery();
FormRowSet f = new FormRowSet();
f.setMultiRow(true);
while (rs.next())
f.add(vRow);
}
return f;
}
Using beanshell options binder to populate a select list