View_CRUD::formSubmit PHP Method

formSubmit() protected method

Called after on post-init hook when form is submitted.
protected formSubmit ( Form $form )
$form Form Form which was submitted
    protected function formSubmit($form)
    {
        try {
            $form->update();
            $self = $this;
            $this->app->addHook('pre-render', function () use($self) {
                $self->formSubmitSuccess()->execute();
            });
        } catch (Exception_ValidityCheck $e) {
            $form->displayError($e->getField(), $e->getMessage());
        }
    }

Usage Example

Ejemplo n.º 1
0
 function formSubmit($form)
 {
     if ($form->model->id) {
         //            TODO- check if class is dirty or changed and if fee associated with the old class is still applied to this
         //            STUDENT then throw messgae and return
     } else {
         $scl = $this->add('Model_Scholar');
         $scl->addCondition('scholar_no', $this->form->data['scholar_no']);
         $scl->tryLoadAny();
         if ($scl->loaded()) {
             $this->form->displayError('scholar_no', "Duplicate Scholar No " . $this->form->data['scholar_no']);
             return;
         }
     }
     parent::formSubmit($form);
     $this->form->model->associateClassFeeses();
 }