Populate a select tag with dynamic values or from table

Hi there, how to populate a select tag with no fixed value or from table?
I mean, for example, i would like populate the select tag from current year to next 10 years.
Have you any idea?

Thanks in advance
Joe

You may see Server Events and Client Scripts → Server Events → Table-Specific → Common → Lookup_Selecting → Example 4 in the help file. (v2021)

In order to implement setOptions method for Lookup object, then you have to enable Use lookup table, after that, you have to setup the Lookup Table by selecting the Table name, Link field, and at least Display field #1.

In addition, make sure you have already disabled Use modal dialog for lookup.I have just tested this from the demo project for products table. I setup the SupplierID field just like I mentioned above, and then I put this code in Lookup_Selecting server event of the products table:

    if ($fld->Name == "SupplierID")
        $fld->Lookup->setOptions([
            ["link1", "display value 1", "", "", ""],
            ["link2", "display value 2", "", "", ""],
            ["link3", "display value 3", "", "", ""],
            ["link4", "display value 4", "", "", ""]
        ]); // Use static array

And it works properly. The static option is now displayed as expected.The conclusion is, since you are using setOptions method that belongs to the Lookup object, then you are still having to setup the Lookup Table as usual.

Also work for User Values. (v2022)

Great. Thanks for the info. This is one of the improvements I like from v2022.