CF6 - basic question on Dropdown

riccardoc 17 Apr, 2020
Hello, I know I'm doing a stupid question but I'm really not able to find the answer in the forum.
I'm realizing a form that read/save data from a db, I have a field in which I can write 1 2 3 or 4, I want to use a dropdown menu, writing {var:read_data.tblname.field} in the option field I can read the value from the table but: how can I add the other 3 options on the dropdown menu? I did it several times in CF5 but really can't do that in v6.
healyhatman 18 Apr, 2020
It needs to end up in the form key => value. So set your database read to "retrieve an array of key / value pairs", and use {var:read_dataname} in the options list.

There's a demo form explaining this.
riccardoc 20 Apr, 2020
Thanks healyhatman, it's probably my poor English but it looks strange to me to do that kind of operation in the database since I have only a rigid choice of 4 options, at the end I simply wrote in the option field:
{var:read_data.tblname.field}
1=1
2=2
3=3
4=4
and it works (I did it at the beginning and it seems not to save the value in db, for sure I did something wrong in configuration).
Thanks for helping me.
This topic is locked and no more replies can be posted.