beforeValidate CoPersonRole sets incorrect message

XMLWordPrintable

      The beforeValidate() method for the CoPersonRole model is currently

       public function beforeValidate($options = array()) {    if(!empty($_REQUEST['data'][$this->alias])) {      
      foreach ($_REQUEST['data'][$this->alias] as $field => $value) {
              if(strpos($field, '-required') !== false) {
                // Just found a required field. We will update the rule accordingly
                // required means that the field should be non-empty and present
                // $ea['required'] = !($ea['allow_empty'] && $vv_allow_empty_cou);
                $field = explode('-', $field)[0];
                $this->validate[$field]['content']['required'] = true;
                $this->validate[$field]['content']['allowEmpty'] = false;
                $this->validate[$field]['content']['message'] = "COU is required";
              }
            }
          }    return parent::beforeValidate($options);
        }

      Note that the message key is set to "COU is required" for all fields and not just the COU field.

            Assignee:
            Arlen Johnson
            Reporter:
            Scott Koranda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: