/**
  * Toggle Subpalette
  * @param      $id
  * @param      $strField
  * @param bool $blnLoad
  *
  * @return ResponseError|ResponseSuccess
  */
 function toggleSubpalette($id, $strField, $blnLoad = false)
 {
     if (!$this->dc->isSubmitted()) {
         return;
     }
     $varValue = Request::getPost($strField) ?: 0;
     if (!is_array($this->dca['palettes']['__selector__']) || !in_array($strField, $this->dca['palettes']['__selector__'])) {
         \Controller::log('Field "' . $strField . '" is not an allowed selector field (possible SQL injection attempt)', __METHOD__, TL_ERROR);
         return new ResponseError();
     }
     $arrData = $this->dca['fields'][$strField];
     if (!Validator::isValidOption($varValue, $arrData, $this->dc)) {
         \Controller::log('Field "' . $strField . '" value is not an allowed option (possible SQL injection attempt)', __METHOD__, TL_ERROR);
         return new ResponseError();
     }
     if (empty(FormHelper::getFieldOptions($arrData, $this->dc))) {
         $varValue = intval($varValue) ? 1 : '';
     }
     $this->dc->setSkipValidation(true);
     // do not validate fields
     $this->dc->setDoNotSubmit(true);
     $this->dc->activeRecord->{$strField} = $varValue;
     $objResponse = new ResponseSuccess();
     if ($blnLoad) {
         $objResponse->setResult(new ResponseData($this->dc->edit(false, $id)));
     }
     return $objResponse;
 }
 /**
  * Return the Submission of the form, if nothing was submitted, return null
  *
  * @param bool $blnFormatted    set false, if the real value should be set
  * @param bool $blnSkipDefaults skip default values, helpful if nothing was submitted
  *
  * @return \FilesModel|Submission|\Model|null
  */
 public function getSubmission($blnFormatted = true, $blnSkipDefaults = false)
 {
     $arrSubmission = $this->arrSubmission;
     if (!$this->isSubmitted()) {
         $arrSubmission = $blnSkipDefaults ? array() : $this->getDefaults();
     }
     if (($this->hasNoEntity() || !$this->hasDatabaseTable()) && is_array($arrSubmission)) {
         $arrDca = $this->getDca();
         if (empty($arrSubmission)) {
             return null;
         }
         $objSubmission = new Submission();
         foreach ($arrSubmission as $strField => $varValue) {
             $arrData = $arrDca['fields'][$strField];
             if (is_array($arrData['options']) && !Validator::isValidOption($varValue, $arrData, $this)) {
                 continue;
             }
             if ($blnFormatted) {
                 $objSubmission->{$strField} = FormSubmission::prepareSpecialValueForPrint($varValue, $arrData, $this->strTable, $this);
             } else {
                 $objSubmission->{$strField} = $varValue;
             }
         }
     }
     return !$this->hasDatabaseTable() || $this->hasNoEntity() ? $objSubmission : $this->objActiveRecord;
 }