Defect #998
No selected in form list menu
| Status: | Completed | Start: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | leo | % Done: | 100% |
|
| Category: | frontend | |||
| Target version: | 2.7.4 |
Description
In TL 2.7.3 (maybe all 2.7) Into the "Form generator" I create a "List menu" with some items. I set one of them to "default". When I render the page in frontend the selected item is not set. I tried the same thing on another site in 2.6.2, that's OK
History
Updated by Nina about 1 year ago
Are you talking about a "select menu"? I just created a "select menu", a "checkbox menu" and a "radio button menu" in the form generator of the Demo site (each time with a differen default option).
They all got rendered with their selected default-option. I can't find a bug here.
Updated by leo about 1 year ago
If you just hit the reload button, Firefox remembers your current settings and does not change the drop-down menu. Try to enter the URL into the address bar and then hit enter. Does this solve your problem?
Updated by cyril about 1 year ago
After the Nina's answer I decide to do some test on my computer with Wampserver 2.
The result of my tests is very strange :|
1 - I upgrade a 2.6.7 (with demo site) version to a 2.7.3, I add a list menu, it's OK, the selected option is here.
2 - I install a fresh 2.7.3 (with demo site) add a list menu with the same options, the selected value is not here :(
3 - After that I decided to invert the databases, on my "updated" installation I put the fresh database, now the listmenu doesn't works...
4 - I decide to see 'tl_form_field' table. The records are the same on the two databases. Just the structure is different: fields are not on the same order.
5 - I don't understand :|
Updated by cyril 12 months ago
Hi Leo,
This morning, I continue my tests :)
I install 2 versions : 2.6.7 and 2.7.0, for each I import example_website.sql
Into the "Term paper submission" form I add a "select menu" with 3 options test1, test2, test3 and I set test2 as default.
I modify "system\modules\frontend\FormSelectMenu.php" I write on line 196 : print_r($arrOption);
The output :
With 2.6.7 :
Array
(
[value] => test1
[label] => test1
)
Array
(
[value] => test2
[label] => test2
[default] => 1
)
Array
(
[value] => test3
[label] => test3
)
<select name="test" id="ctrl_13" class="select">
<option value="test1">test1</option>
<option value="test2" selected="selected">test2</option>
<option value="test3">test3</option>
</select>
With 2.7.0 :
Array
(
[value] => test1
[label] => test1
)
Array
(
[value] => test2
[label] => test2
[default] => 1
)
Array
(
[value] => test3
[label] => test3
)
<select name="test" id="ctrl_12" class="select">
<option value="test1">test1</option>
<option value="test2">test2</option>
<option value="test3">test3</option>
</select>
As you can see " selected="selected" disappear on 2.7.0
After, I upgrade my 2.6.7 to 2.7.0 without re-import the site template.
Now this updated version is OK :
Array
(
[value] => test1
[label] => test1
)
Array
(
[value] => test2
[label] => test2
[default] => 1
)
Array
(
[value] => test3
[label] => test3
)
<select name="test" id="ctrl_13" class="select">
<option value="test1">test1</option>
<option value="test2" selected="selected">test2</option>
<option value="test3">test3</option>
</select>
Strange isn't it ?
Updated by cyril 12 months ago
Just for complete: this problem is the same with "Radio button menu" and "Checkbox menu"
Updated by leo 12 months ago
- Status changed from New to Accepted
This one was really hard to figure out. It has something to do with the order of the fields of table tl_form_fields. If "value" comes before "options", it works like a charm. However, if "options" comes before "value", which is e.g. the case in installations prior to version 2.7, it does not.
Also available in: Atom