Select Widget - How to pass two values ?

1
0
-1

Hey guys,
In a select widget you can set the displayed key (in my case: E-Book), returned key (in my case: 490$) and the value (in my case $item.price).
xcxcxcxc.png

My problem is, that I need to fill two variable, because on the next page I want to see what the customer choosed and what the price is. For now, I only see the price.
How can I set the name of the product (->E-Book) and the price (->50$), by selecting "E-Book"?

I tried to write both things in one inputfield like:
cccxxxxx.png

8 answers

1
+1
-1

that widget returns all values for selected line. for example,
[
{"id":0,"label":"ebook","value":"490"},
{"id":1,"label":"Presse","value":"2800"},
{"id":2,"label":"Textbook","value":"800"}
]
if you fill that widget with this json data then create a new variable as empty json named "selectedData" and set value field in widget with that "selectedData" variable. when you selected an object like "ebook" it will return to you all this like {"id":0,"label":"ebook","value":"490"}, after that you can get values as you want, selectedData.label, selectedData.value, selectedData.id etc.

1
+1
-1

your json should look like this
[
{"id":0,"label":"ebook","value":"490"},
{"id":1,"label":"Presse","value":"2800"},
{"id":2,"label":"Textbook","value":"800"}
]
and your widget should configure like this
Display key:label
Return key:id
value:id
and you can show it:{{product[id].label}} ,{{product[id].value}}

1
+1
-1

you can use this widget to return json data and use it as you like, https://community.bonitasoft.com/project/widgetautocompletekey

1
+1
-1

Add to an id to your json and return the id from the Select widget.
Also add the same json to the next page and you can show selected e-book(product[id].ebook) and the price(product[id].price)

1
0
-1

@msakirkutlu_1359205
Hey, I got another problem. Your solution works only for one field, but I have a Button "add" to add new field to a collection. I guess the problem is that after adding a second field, both fields are using one and the same selectedData-Json-Object :/ You know how to fix that?

1
0
-1

ok, thanks, it works!:) You both helped me and both solutions worked for me :)
I would like to mark both as the best answer :/ but cant

It is really rare that someone answers here in the forum. So thanks alot! I appreciate it

1
0
-1

@msakirkutlu_1359205

thanks for the fast answer. But how can this widget help me with my problem? I have there also only one value I can set. But I need set to variables for the next page.
For now Im only setting one variable and this is the price.

1
0
-1

@dkoume_1353153
thanks for the fast answer. Sorry, Im new to this whole stuff and dont know how to do that :/
I tried to do something like that with a javascript in the ui-designer, but then I didnt know how to reference to my javascript. I did something like this:
yxcyxcyxc.png
xcsdfsds.png

Notifications