Page 1 of 1

ComboBox Values?

Posted: Thu Jun 19, 2025 5:32 pm
by peters
I have several Combo Boxes I am using in a web page.
I want the Combo Box displayed value to = the value of a PHP memory variable holding the required Combo Box value.
Let's day the Combo Box holds all the provinces for Canada abbreviated.
"ON" for Ontario
"QE" for Quebec,
etc.
a PHP memvar called $p6 = "QE"
If I was hard coding this for all the provinces, I would do something like the following listed below:
<option value="ON" <?= $p6 == "ON" ? "selected" : "" ?>>ON</option>
<option value="QC" <?= $p6 == "QC" ? "selected" : "" ?>>QC</option>
<option value="MB" <?= $p6 == "MB" ? "selected" : "" ?>>MB</option>

Try as I might in the value setting in the ComboBox items when entering in the string, when generated I get the following:
<option value="ON" <?= $p21 == "ON" ? "selected" : "" ?>>">ON</option>
<option value="QC" <?= $p21 == "QC" ? "selected" : "" ?>>">QC</option>
<option value="MB" <?= $p21 == "MB" ? "selected" : "" ?>>">MB</option>

If you compare the two different versions above the latter one that is newly generated as an extra "> in the string.
Not big deal, I go in and manually edit the line and remove the "> and things work as I want them to.

In the value entry for each item for the Combo Box I am entering in the value as shown below:
ON" <?= $p21 == "ON" ? "selected" : "" ?>>

Is there a way to enter in the value within WYSIWYG's interface at the Combox Box value entry that would allow me to generate Combo Boxes with a value that does not require the manual editing of each value line?

Thanks in advance for any suggestions!

Re: ComboBox Values?

Posted: Thu Jun 19, 2025 7:45 pm
by Pablo
Obviously, the "> is needed t to close the value.

But you can add some extra code to make your custom code valid
For example

Code: Select all

ON" <?= $p6 == "ON" ? "selected" : "" ?> title="