how to set a default selection in a dynamically generated radio buttons



I have a page made with UI designer which contains a radio buttons widget.

The available values are filled using a javascript expression retrieving all the groups the user belongs to :

function getGroupNames(data) {
var noms = [];
for( var i = 0; i < data.length; i++ ) {
noms[i] = data[i];
return noms;

return getGroupNames( $data.listeGroupes );

The selected value is a string variable.

When the page is displayed, no radio buttons is selected but I would like to select the first radio button by default.

I tried to set the value of the "selected value" variable at the end of the getGroupNames() function. It works but when I click on other radio button values, the black point in the button is not displayed anymore (although the values are correctly selected functionally)

Any hints?


1 answer


Hello torea_1402565,

You need to put the default value in the formInput.

Exemple: {

P.S: "Refused" is the value of the Radio Button


Submitted by torea_1402565 on Wed, 01/15/2020 - 20:40

Thank you for the hint but as the values are retrieved dynamically, how can i put the first value in the formInput as I don't know it at the beginning?