1
0
-1

Hi Expert,

 

I'm Joget Starter. I have a question on ajax subform in V4. below in my img.

 

 

I create select box with current user, group by department.  

--------------------------------------

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:3307/jwdb?characterEncoding=UTF-8", "root", "");

FormRowSet select_user = new FormRowSet();
select_user.setMultiRow(true);



if(!con.isClosed()){
String deptname = "#currentUser.department.name#"; 
PreparedStatement stmt = con.prepareStatement("select u.id, CONCAT(CONCAT(u.firstName, ' '), u.lastName) from dir_user u join dir_employment e on e.userId = u.id join dir_department d on d.id = e.departmentId where d.name = '#currentUser.department.name#' order by firstname asc"); 
ResultSet rs = stmt.executeQuery(); 

FormRow user_row = new FormRow();
user_row.put(FormUtil.PROPERTY_VALUE, "");
user_row.put(FormUtil.PROPERTY_LABEL, " - Select - ");
select_user.add(user_row);

while (rs.next()){
FormRow user_row = new FormRow();
user_row.put(FormUtil.PROPERTY_VALUE, rs.getString(1));
user_row.put(FormUtil.PROPERTY_LABEL, rs.getString(2));
select_user.add(user_row);
}
}

return select_user;

---------------------------------

After selected user, my ajaxform show user detail.

how can i get select box value in bean shell form builder?

i saw V5

http://dev.joget.org/community/display/KBv5/AJAX+Subform

 

how i can make it. Thank you.

    CommentAdd your comment...

    3 answers

    1.  
      1
      0
      -1

      Hi,

      It should be no different with Bean Shell Programming Guide: Use as Form Load Binder. You can get the selected value from an injected "primaryKey" variable.

       

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi, please help to accept my answer if it helps. This will helps other who are looking for similar answer too. Thanks and have a nice day too. (smile)

          CommentAdd your comment...
        1.  
          1
          0
          -1

          Hi Owen,

          Great, Solve it.

          We have to plan, purchase license version. Now i testing, how can I manage it. 

           

          Have a nice day.

           Thank you.

            CommentAdd your comment...