How to make a radio button

Hello

I need help for make a radio button in a form in a bpmn.

I would like to have a radio button with Yes and No ("available values" ?) and it returns a string to an input contract (field "returned key" ?) when form is submitted. I have a String input in the contract (in french) "ndf.approbationService".

But i don't achieve to understand how it's supposed to work.

Link to the screenshot

Bonita version is Community 2021.1 : 7.12.1.1

Can you help me about that please ?

Best regards

Hello Romain,

Fields "displayed key" and "returned keys" are used for complex values. 

You can specify a JSON for "availables values". In this case, you can display a key of the json and return a different one.

Value must be set in "selected value". As it's a bidirectional binding, your radio button will be set with "ndf.approbationService", and this value will be update when you change the radio button value.

I hope that will help you.

Hi Romain,

The error seems to occur on a human task, right?

Can you check the contract of this task?

Can you also check your operation script (called ndfInput.approbationService)?

I reproduced your problem by creating a task with a text value in the contract, and trying to associate that value with a boolean variable.

If I change my contract input to a Boolean type, the error disappears.

Hello

I've an other question : the value ndf.approbationService must be a boolean in order to make the radio button work ?

Because I get an errror, it seems the program tries to transform the value in boolean. I've made a string one.

Best regards

Hello Romain,

You can specify any type of variable for the selected value.

Maybe you have a Javascript expression that tries to transform your value?

What kind of error do you have?

 

 

Hi Romain,

The radio button widget does not force the selected value into a specific type.

Maybe the issue comes from the type defined in your contract ?

I got the following error : org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=1660003 | Declared return type class java.lang.Boolean is not compatible with evaluated type class java.lang.String for expression ndfInput.approbationService

In the contract is defined a boolean one but it goes to a radio button yes/no in the form.