Forums

Wrong selected value in Dropdown

Lorentz 15 May, 2018
Hi,

I looked up informations in FAQ and forum about the field Selected Value in drop down field but I found nothing solving (one of) my problem(s).

If I set a selected value (with php or custom form), I never get the right key/value expected.

To make tests, I tried with a simple dropdown. Originally, options are fed by a read_data key/value but I did it manually for this example below.




By this way, I thought the dropdown would display le label "21", 22 being the key, or would display 22 like I wrote in the field (and the value key 23).

But this is the result :



I've changed the multi select dropdown option to YES and I don't understand the result :



I only put one value in the selected value list and there is three selected.


Any idea of what I did wrong ?

Thanks
Lorentz 16 May, 2018
Hi,

I am still stuck on this.

No one see the mistake i've done ?
Lorentz 17 May, 2018
Well, still stuck ...

I did quite a lot of tests without results and hardly I think I've found a way to identify the problem but I don't know how to solve it.

I did this options List and selected in a dropdown :



the result is :



I identify two problems :
  1. dropdown doesn't use my argument "07" as is, means like a string, It probably changes it before the array search in a numeric value : 7. This is why it doesn't offer me the options 10=07.
  2. I can't specify where to look, key or field, and it seems to do both, so I obtain the image result above.

How can I solve this problem ?
Lorentz 18 May, 2018
Answer
I partially solved my problem using a CONCAT in field to retrieve in the read_data feeding the dropdown.

In my case :
id
Concat(departement_code , ' ' , departement_nom)
instead of
id
departement_code

In this way, there's no more unique integer in the value field of the dropdown and no more problems.

So I put this topic on "answered" even if it's not really the case ...

Either I missed something and I don't understand how to fully use the dropdown arguments
Or it's an unexpected behaviour that need to be solved in an update ...

I hope I'll know one day ...

Thanks for the support ...
This topic is locked and no more replies can be posted.