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#223: [2.0.7] Saving required and allow multiple Select Box Link fails

In symphony/lib/toolkit/class.field.php:288

In case a field is selected to allow multiple, $data is not a String but an Array. This means

public function checkPostFieldData($data, &$message, $entry_id=NULL){
    $message = NULL;

    if ($this->get('required') == 'yes' && strlen($data) == 0){
        $message = __("'%s' is a required field.", array($this->get('label')));
        return self::__MISSING_FIELDS__;
    }   
    return self::__OK__;        
}

Must be replaced by

public function checkPostFieldData($data, &$message, $entry_id=NULL){
    $message = NULL;

    if ($this->get('required') == 'yes' && (
        (!is_array($data) && strlen($data) == 0) || (is_array($data) && count($data) == 0)
        )) {
            $message = __("'%s' is a required field.", array($this->get('label')));
            return self::__MISSING_FIELDS__;
        }
    return self::__OK__;        
}

Uhm… yes. This reaction doesn’t exactly surprise me.

There was a problem that prevented this issue from displaying. Thanks for the fix, we’ll look at getting it implemented ASAP.

“Allow Multiple” should not cause an array of data to get passed into the checkPostFieldData function. Fields::checkPostFieldData() only ever expects to get a string. If a field type expects to get an array of data, it should handle that by overloading the checkPostFieldData function. I’ll need to look into why setting “Allow Multiple” would change what the function receives.

I am having no such problem using a basic section built with core fields. What fields are in your section? What does the form markup look like?

Discussed with team. There really isn’t a problem here, more a mis-understand as to how the function works.

Allow multiple will iterate over each group of field values, and process them as if it was a single entry.

Closing issue.

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