Suggestion: Little change in validation plugins

mxmauro

New Member
Hi,

I see that many validation plugins starts with a code like this:

PHP:
if (is_array($data)) {
  $data = implode('', $data);
}

The problem with this approach is that, in multiple selection items, $data is joined in a single string, and is it almost impossible separate each item to perform some validations for e.g., if more than 3 options were selected (mainly when using the php/regex plugin).

I recommend to remove that part of the code or to change it to:

PHP:
if (is_array($data)) {
  $data = implode(GROUPSPLITTER, $data);
}

in order to mantain compatibilty and to be able to explode the string if necessary.

Regards,
Mauro.
 
Hmmm, I'm not sure why we do that, especially in the PHP plugin. I'll have a think. I can't really see the point of joining multiple selects with no sepchar.

Of course, you can always get at the data through $formModel->_formData[], or through J!'s JRequest API (or whatever is replacing that in 2.5), or direct from the $_POST array.

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

Thank you.

Members online

No members online now.
Back
Top