How to develop a widget type select with the name Select1 passing variable to Select2 in form? (drill down, dependence between widget)

1
0
-1

Group; I'm using BonitaSoft Community version 6.5.2 ;

I have the following challenge:

Make a Select type widget with the name bd_mnt_niveis1 be criteria to display values ​​in the widget name bd_mnt_niveis2 (Type a drill down or dependent list) and so then to bd_mnt_niveis3 as below:

image I have the variables in the Pool:

Data type: Objeto Java Class: java.util.List Is multiple

var_bd_mnt_niveis1 | Objective: To receive the widget bd_mnt_niveis1 var_bd_mnt_niveis2 | Objective: To receive the widget bd_mnt_niveis2 var_bd_mnt_niveis3 | Objective: To receive the widget bd_mnt_niveis3 bd_mnt_niveis | Objective: Since receiving the MySQL Data Base connector - Mother with attributes: ID_NIVEL | NIVEL_1 | NIVEL_2 | NIVEL_3

On widget bd_mnt_niveis1 | Aba Dados | Available values:

int x = 0;
int y = bd_mnt_niveis.size();
List<String> retorno = new ArrayList<String>();
while(x<y) {
        retorno.add(bd_mnt_niveis[x][1]);
        x++;
}
return new ArrayList(new HashSet(retorno));

Output operation: var_niveis_nivel1 add field_bd_mnt_niveis1

On widget bd_mnt_niveis2 | Aba Dados | Available values:

int x = 0;
int y = bd_mnt_niveis.size();
List<String> retorno = new ArrayList<String>();
while(x<y) {
        if (bd_mnt_niveis[x][1]=="Mecânica") {
                retorno.add(bd_mnt_niveis[x][2]);
        }
        x++;
}
return new ArrayList(new HashSet(retorno));

Output operation: var_niveis_nivel2 add field_bd_mnt_niveis2

Where it says "Mecânica" would like to receive the value of field_bd_mnt_niveis1 to stay dynamic

Does anyone have any idea how to make the widget Select bd_mnt_niveis2 be dynamic as the user chooses in bd_mnt_niveis2?

*Forgive me if I messed up a little in translation, I am Brazilian

4 answers

1
+2
-1
This one is the BEST answer!

Your issue is what we call Contingent Fields, feild 2 is contingent on the value of field 1 etc.

first thing you should know is this is freely available only in Subscription Bonita and not available in Community.

For this particular example, I would program this as follows:

Field 1 has a Javascript onchange event

And in the event code use an ajax call to call a webservice to retrieve and return the data and modify field 2 with the contingent data. field 2 can do the same etc...

this is what we do very successfully,

regards Seán

1
0
-1

Thanks for the friend tips, Sean McP; This test is more personal and experimental, and would not have money to pay a consultant for this service, I will have to do in faith and courage; I'll find something on the internet on how to make interaction with Ajax Javascript, I tell you it will be a big challenge for me, since I am no expert in programming, so any hint already helps me as you passed me, even something ready to give to and then changing the logic.

Thank you, I'll be in the fight.

1
0
-1

Comments

Submitted by Sean McP on Mon, 06/29/2015 - 14:17

Sorry Mario, but I have my own work to do, I could help you if you can show me what you've done, but beyond that...

Step 1 create a webservlet to get the data you need from a passed variable/parameter. verify it using system.out etc. I would use Eclipse EE to do this.

Step 2 create an Ajax call from web application to call the webservlet and test this,

Step 3 create the necessary Javascript to tie your field to the ajax and populate the field.

This isn't really Bonita code and there are many resources out there to allow you to do this, otherwise I would have to charge cinsultant rates to do the work for you...

I need to eat too... :)

regards

1
0
-1

Thanks for the reply , is beginning to lighten me; But you would have an example of this configuration for me to replicate or adapt?

Notifications