PHP validation returning incorrect $data value

Bauer

Well-Known Member
I was just testing an element PHP validation (I updated from github this morning) and came upon this new bug.
(See the screen shot attached to see the simple test configuration.)

This is what that PHP validation configuration echoes to the screen when the form is validated...
Array ( [6] => 7 [8] => 9 [13] => 14 )
7914

So the 'Condition' is working as expected
But it looks like the 'PHP Code' is returning the equivalent of
implode("", $data); o_O
 

Attachments

  • phpValidation1.png
    phpValidation1.png
    33.7 KB · Views: 92
Yup, I answered this on another post. For reasons lost to the mists of time, we implode the data if it's an array ...

Code:
        // For multi-select elements
        if (is_array($data))
        {
            $data = implode('', $data);
        }

Not keen on changing that right away, because it's been that way forever, and that would break backward compat. So for now you can just access the data through the $formModel->formData[] array.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top