/**
  * Render the JSON outbut for a submit action to be used by ExtJS Form submit
  * @param \GO\Base\Db\ActiveRecord $model
  * @return \GO\Base\Data\JsonResponse Response object
  */
 public function renderSubmit($model)
 {
     $response = array('feedback' => '', 'success' => true);
     //$ret = $this->beforeSubmit($response, $model, $params);
     //$modifiedAttributes = $model->getModifiedAttributes();
     if (!$model->hasValidationErrors() && !$model->isNew) {
         //model was saved
         $response['id'] = $model->pk;
         //If the model has it's own ACL id then we return the newly created ACL id.
         //The model automatically creates it.
         if ($model->aclField() && !$model->isJoinedAclField) {
             $response[$model->aclField()] = $model->{$model->aclField()};
         }
         if ($model->aclOverwrite()) {
             $response[$model->aclOverwrite()] = $model->{$model->aclOverwrite()};
         }
         //TODO: move the link saving to the model someday
         if (!empty($_POST['link']) && $model->hasLinks()) {
             //a link is sent like  \GO\Notes\Model\Note:1
             //where 1 is the id of the model
             $linkProps = explode(':', $_POST['link']);
             $linkModel = \GO::getModel($linkProps[0])->findByPk($linkProps[1]);
             $model->link($linkModel);
         }
     } else {
         // model was not saved
         $response['success'] = false;
         //can't use <br /> tags in response because this goes wrong with the extjs fileupload hack with an iframe.
         $response['feedback'] = sprintf(\GO::t('validationErrorsFound'), strtolower($model->localizedName)) . "\n\n" . implode("\n", $model->getValidationErrors()) . "\n";
         if (\GO\Base\Util\Http::isAjaxRequest(false)) {
             $response['feedback'] = nl2br($response['feedback']);
         }
         $response['validationErrors'] = $model->getValidationErrors();
     }
     $this->fireEvent('submit', array(&$this, &$response, &$model));
     return new \GO\Base\Data\JsonResponse($response);
 }