SELECT widget keeps reloading when value is set via javascript

1
0
-1

When we display the form, the SELECT widget keeps "jumping" between the 1st value in the list and the populated value. (see Recording)

The SELECT widget has Available values from json received from a BDM table. (codeValue.json).

We have a javascript script that populate the value of the SELECT widget based on a URL parameter that is received. (URL parameter id -> call BDM to retrieve record -> javascript to copy to formInput)

//javascript
var formControl ={};

if($data.p_horaireId !=='' && !$data.initialized)
{
$data.formInput.unHoraireInput.jour = $data.horaireBDM[0].jour;

$data.initialized = true;

}

return formControl;
//

Is this a bug with Bonita 2021.1?

Comments

Submitted by dmartineau on Mon, 08/02/2021 - 15:04

We did some investigations and found out that the issue is related to the fact that the Return Key was an integer instead of string.

I looked in the documentation and did not see any restriction on this. In our case, we do need to save the value as an integer to do further processing.

Is there a way to use Integer as Return Key?

Submitted by romain.bioteau on Tue, 08/03/2021 - 09:14

Return Key and Return Value are json attribute names, so they are String. The value returned however can be of any type depending on your objects. You can return the whole object by leaving the Return Value field empty.

Can you elaborate your use case ?

Submitted by dmartineau on Mon, 08/16/2021 - 15:45

As mentioned above, we need to have the return key to be an Integer. When we changed the to a string the Widget was working fine. Also, we are setting the value of the Select with Javascript in the UI Designer.

No answers yet.
Notifications