Bug #7448
Text input receive no value if selected checkboxes are above them
| Status: | Resolved | Start date: | 2010-04-23 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | View | |||
| Target version: | Beta 5 (v0.9.8) | |||
| Votes: | 0 |
Description
Hi,
Just started using formhandler, amazing extension thanks!
Just one minor issue. If there's an array of checkboxes ABOVE text inputs and one of them is selected, the following inputs will have empty values. I quickly digged into the classes and found sth. in Tx_Formhandler_View_Form->getValueMarkers:
foreach($values as $k => $v) {
...
if (is_array($v)) {
$level = $level + 1;
$markers = array_merge($markers, $this->getValueMarkers($v, $level, $currPrefix));
$v = implode(',', $v);
}
...
If there's an array $level will get raised, the recursion occurs, but $level will never get reset again. Therefore the markers for following inputs contain "|".
I think it should be like that:
if (is_array($v)) {
$level ++;
$markers = array_merge($markers, $this->getValueMarkers($v, $level, $currPrefix));
$v = implode(',', $v);
$level --;
}
It works, but I'm not quite sure if I understood the meaning of $level really ...
The bug is very easily reproducable with the SingleStep Example, just move the interests section on top.
Just for giggles, i'm using 4.3.3 and 0.9.7.
Cheers
History
Updated by Reinhard Führicht about 3 years ago
- Status changed from New to Resolved
Committed to trunk.
Thanks for the hint. Your suggested changes worked fine, you understood the meaning of $level perfectly right! :-)
Updated by Roberto Miguel Rivas Jordán about 3 years ago
I think just
$markers = array_merge($markers, $this->getValueMarkers($v, $level + 1, $currPrefix));
and deleting "$level ++;" and $"level --;" would be cleaner.
That's what I did, and later found this report :(