Page 1 of 1
Funny problem with select box
Posted: Wed May 11, 2022 4:53 am
by rads
According to the doc
umentation Choice values property may be populated with
"A simple list of values separated by just a comma (i.e. Option 1, Option 2, Option 3, etc...)."
Now one of our users had the idea to create a new record with a comma in the key.
Of course, the select box providing records from this table goes Amok :).
Any idea anybody?
Re: Funny problem with select box
Posted: Wed May 11, 2022 9:00 am
by Emily
Hi rads,
This problem can be solved by use of square brackets ([]) and quotation marks. See below for an example.
The 'choices' property is setup like so (notice that 2 of the options have commas included):
- image1.png (2.55 KiB) Viewed 3381 times
Running the program results in the following for the select box:
- image2.png (4.88 KiB) Viewed 3381 times
If you are using a bound field for this, you would do something similar in your RPG program.
Hope that this helps!
Re: Funny problem with select box
Posted: Wed May 11, 2022 6:02 pm
by Scott Klement
Using the technique that Emily posted, if you run into any other special characters that need to be escaped (for example, double quotes in the string, or square brackets, etc) they'd be escaped according to the standard for a JSON array. Details are here:
https://www.json.org/json-en.html
For example:
Code: Select all
[ "Rainer", "Emily", "Scott \"Crazy Guy\" Klement" ]
Re: Funny problem with select box
Posted: Thu May 12, 2022 3:13 am
by rads
Excellent :)
Is this mentioned in the documentation?
If not, please consider to mention this in the documentation for select boxes.
Thank you,
Rainer
Re: Funny problem with select box
Posted: Thu May 12, 2022 4:11 am
by rads
Why on earth is "dokumentation" replaced by "***"?
Re: Funny problem with select box
Posted: Thu May 12, 2022 9:09 am
by Scott Klement
I was wondering the same thing about *** -- very strange
Re: Funny problem with select box
Posted: Wed Jul 06, 2022 7:24 am
by BFoster
TFM? ... as in RTFM?