Changeset 603

Show
Ignore:
Timestamp:
10/01/07 17:56:44 (1 year ago)
Author:
laurentj
Message:

fixed bug #292, jControllerDaoCrud: previous errors in a form for creation, were not erased in some case. Added a new action, precreate, to fix it

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php

    r597 r603  
    167167        $tpl->assign('controls',$form->getControls()); 
    168168        $tpl->assign('editAction' , $this->_getAction('preupdate')); 
    169         $tpl->assign('createAction' , $this->_getAction('create')); 
     169        $tpl->assign('createAction' , $this->_getAction('precreate')); 
    170170        $tpl->assign('deleteAction' , $this->_getAction('delete')); 
    171171        $tpl->assign('viewAction' , $this->_getAction('view')); 
     
    190190    protected function _index($resp, $tpl) { 
    191191 
     192    } 
     193 
     194    /** 
     195     * prepare a form to create a record. 
     196     */ 
     197    function precreate() { 
     198        // we cannot create the form directly in the create action 
     199        // because if the forms already exists, we wouldn't show 
     200        // errors or already filled field. see ticket #292 
     201        $form = jForms::create($this->form); 
     202        $rep = $this->getResponse('redirect'); 
     203        $rep->action = $this->_getAction('create'); 
     204        return $rep; 
    192205    } 
    193206 
  • branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php

    r597 r603  
    167167        $tpl->assign('controls',$form->getControls()); 
    168168        $tpl->assign('editAction' , $this->_getAction('preupdate')); 
    169         $tpl->assign('createAction' , $this->_getAction('create')); 
     169        $tpl->assign('createAction' , $this->_getAction('precreate')); 
    170170        $tpl->assign('deleteAction' , $this->_getAction('delete')); 
    171171        $tpl->assign('viewAction' , $this->_getAction('view')); 
     
    190190    protected function _index($resp, $tpl) { 
    191191 
     192    } 
     193 
     194    /** 
     195     * prepare a form to create a record. 
     196     */ 
     197    function precreate() { 
     198        // we cannot create the form directly in the create action 
     199        // because if the forms already exists, we wouldn't show 
     200        // errors or already filled field. see ticket #292 
     201        $form = jForms::create($this->form); 
     202        $rep = $this->getResponse('redirect'); 
     203        $rep->action = $this->_getAction('create'); 
     204        return $rep; 
    192205    } 
    193206 
  • trunk/lib/jelix/controllers/jControllerDaoCrud.class.php

    r597 r603  
    167167        $tpl->assign('controls',$form->getControls()); 
    168168        $tpl->assign('editAction' , $this->_getAction('preupdate')); 
    169         $tpl->assign('createAction' , $this->_getAction('create')); 
     169        $tpl->assign('createAction' , $this->_getAction('precreate')); 
    170170        $tpl->assign('deleteAction' , $this->_getAction('delete')); 
    171171        $tpl->assign('viewAction' , $this->_getAction('view')); 
     
    190190    protected function _index($resp, $tpl) { 
    191191 
     192    } 
     193 
     194    /** 
     195     * prepare a form to create a record. 
     196     */ 
     197    function precreate() { 
     198        // we cannot create the form directly in the create action 
     199        // because if the forms already exists, we wouldn't show 
     200        // errors or already filled field. see ticket #292 
     201        $form = jForms::create($this->form); 
     202        $rep = $this->getResponse('redirect'); 
     203        $rep->action = $this->_getAction('create'); 
     204        return $rep; 
    192205    } 
    193206 
  • trunk/lib/jelix/controllers/jControllerDaoCrud.class.php

    r597 r603  
    167167        $tpl->assign('controls',$form->getControls()); 
    168168        $tpl->assign('editAction' , $this->_getAction('preupdate')); 
    169         $tpl->assign('createAction' , $this->_getAction('create')); 
     169        $tpl->assign('createAction' , $this->_getAction('precreate')); 
    170170        $tpl->assign('deleteAction' , $this->_getAction('delete')); 
    171171        $tpl->assign('viewAction' , $this->_getAction('view')); 
     
    190190    protected function _index($resp, $tpl) { 
    191191 
     192    } 
     193 
     194    /** 
     195     * prepare a form to create a record. 
     196     */ 
     197    function precreate() { 
     198        // we cannot create the form directly in the create action 
     199        // because if the forms already exists, we wouldn't show 
     200        // errors or already filled field. see ticket #292 
     201        $form = jForms::create($this->form); 
     202        $rep = $this->getResponse('redirect'); 
     203        $rep->action = $this->_getAction('create'); 
     204        return $rep; 
    192205    } 
    193206 
Download in other formats: Unified Diff Zip Archive