Announcement

Symphony's issue tracker has been moved to Github.

Issues are displayed here for reference only and cannot be created or edited.

Browse

Closed#226: Multiple filters Errors in response

I’ve created form with recaptcha extension attached (it simply works as filter). When user make mistake in form (eg forget required field) and didn’t pass captcha field, errors in event response are only shown for captcha.

I found part of code responsible for that in event.section.php:

if(is_array($filter_results) && !empty($filter_results)){
    foreach($filter_results as $fr){
        list($type, $status, $message) = $fr;
        $result->appendChild(buildFilterElement($type, ($status ? 'passed' : 'failed'), $message));
        if(!$status){
            $result->appendChild($post_values);
            $result->setAttribute('result', 'error');
            $result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.')));
            return false;
        }
    }
}

The problem is with line 45 return false; which returns on first found error and rest of them are not attached to the page.

I’m not sure, but this code should looks like this:

if(is_array($filter_results) && !empty($filter_results)){
    $all_filters_status = true;
    foreach($filter_results as $fr){
        list($type, $status, $message) = $fr;
        $result->appendChild(buildFilterElement($type, ($status ? 'passed' : 'failed'), $message));
        if(!$status) $all_filters_status = false;
    }
    if(!$all_filters_status){
        $result->appendChild($post_values);

        $result->setAttribute('result', 'error');
        $result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.')));
        return false;
    }
}

Status checking should be after all errors have been attached to the page.

This issue is closed.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details