コード例 #1
0
 /**
  * Need to define validationUrl in order to ensure the task id is populated. If it is a new task, then
  * the task id would not be in the GET
  * @return array
  */
 protected function resolveActiveFormAjaxValidationOptions()
 {
     $relationModelId = Yii::app()->request->getParam('relationModelId');
     $action = TasksUtil::resolveModalSaveActionNameForByRelationModelId($relationModelId);
     $validationUrl = Yii::app()->createUrl('tasks/default/' . $action, array_merge(GetUtil::getData(), array('id' => $this->getModel()->id)));
     return array('enableAjaxValidation' => true, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => true, 'validationUrl' => $validationUrl));
 }
コード例 #2
0
 /**
  * Resolves ajax validation option for save button
  * @return array
  */
 protected function resolveActiveFormAjaxValidationOptions()
 {
     //Would be used from kanban board
     $sourceKanbanBoardId = Yii::app()->request->getParam('sourceKanbanBoardId');
     //Would be used from other source
     $sourceId = Yii::app()->request->getParam('sourceId');
     $modalId = $this->resolveModalIdFromGet();
     $relationModelId = Yii::app()->request->getParam('relationModelId');
     $copyAction = Yii::app()->request->getParam('action', null);
     $action = TasksUtil::resolveModalSaveActionNameForByRelationModelId($relationModelId, $copyAction);
     $url = Yii::app()->createUrl('tasks/default/' . $action, GetUtil::getData());
     // Begin Not Coding Standard
     return array('enableAjaxValidation' => true, 'clientOptions' => array('beforeValidate' => 'js:$(this).beforeValidateAction', 'afterValidate' => 'js:function(form, data, hasError){
                             if(hasError)
                             {
                                 form.find(".attachLoading:first").removeClass("loading");
                                 form.find(".attachLoading:first").removeClass("loading-ajax-submit");
                             }
                             else
                             {
                             ' . $this->renderConfigSaveAjax($this->getFormId(), $url, $sourceKanbanBoardId, $modalId, $sourceId) . '
                             }
                             return false;
                         }', 'validateOnSubmit' => true, 'validateOnChange' => false, 'inputContainer' => 'td'));
     // End Not Coding Standard
 }