Changeset 441

Show
Ignore:
Timestamp:
05/21/07 23:23:21 (2 years ago)
Author:
laurentj
Message:

work on jforms : 'form' tpl plugin can now generate header and footer for a html form

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/experimental/jforms/build/manifests/jelix-lib.mn

    r439 r441  
    116116  jFormsDataContainer.class.php 
    117117  jFormsDatasource.class.php 
    118   jforms_jstemplate.php 
    119118 
    120119cd lib/jelix/tpl/ 
     
    155154  function.formurlparam.php 
    156155  function.diff.php 
     156  block.form.php 
    157157 
    158158cd lib/jelix/tpl/plugins/ltx2pdf 
  • branches/experimental/jforms/build/manifests/jelix-lib.mn

    r439 r441  
    116116  jFormsDataContainer.class.php 
    117117  jFormsDatasource.class.php 
    118   jforms_jstemplate.php 
    119118 
    120119cd lib/jelix/tpl/ 
     
    155154  function.formurlparam.php 
    156155  function.diff.php 
     156  block.form.php 
    157157 
    158158cd lib/jelix/tpl/plugins/ltx2pdf 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 
    55datatype.unknow=(804) unknow datatype %1$s  on %2$s (file %3$s) 
     6invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 
    67 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 
    55datatype.unknow=(804) unknow datatype %1$s  on %2$s (file %3$s) 
     6invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 
    67 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.UTF-8.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 
    55datatype.unknow=(804) unknow datatype %1$s  on %2$s (file %3$s) 
     6invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 
    67 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.UTF-8.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 
    55datatype.unknow=(804) unknow datatype %1$s  on %2$s (file %3$s) 
     6invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 
    67 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 
    55datatype.unknow=(804) unknow datatype %1$s  on %2$s (file %3$s) 
    6  
     6invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 
    55datatype.unknow=(804) unknow datatype %1$s  on %2$s (file %3$s) 
    6  
     6invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.UTF-8.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 
    55datatype.unknow=(804) unknow datatype %1$s  on %2$s (file %3$s) 
    6  
     6invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.UTF-8.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 
    55datatype.unknow=(804) unknow datatype %1$s  on %2$s (file %3$s) 
    6  
     6invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s non permis sur %2$s (fichier %3$s) 
    55datatype.unknow=(804) datatype inconnu %1$s sur %2$s (fichier %3$s) 
     6invalid.xml.file=(805) erreur de syntaxe xml dans un fichier jforms (fichier %s) 
    67 
    7  
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s non permis sur %2$s (fichier %3$s) 
    55datatype.unknow=(804) datatype inconnu %1$s sur %2$s (fichier %3$s) 
     6invalid.xml.file=(805) erreur de syntaxe xml dans un fichier jforms (fichier %s) 
    67 
    7  
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.UTF-8.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s non permis sur %2$s (fichier %3$s) 
    55datatype.unknow=(804) datatype inconnu %1$s sur %2$s (fichier %3$s) 
    6  
     6invalid.xml.file=(805) erreur de syntaxe xml dans un fichier jforms (fichier %s) 
  • branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.UTF-8.properties

    r439 r441  
    44attribute.not.allowed=(803) attribut %1$s non permis sur %2$s (fichier %3$s) 
    55datatype.unknow=(804) datatype inconnu %1$s sur %2$s (fichier %3$s) 
    6  
     6invalid.xml.file=(805) erreur de syntaxe xml dans un fichier jforms (fichier %s) 
  • branches/experimental/jforms/lib/jelix/core/jSelector.class.php

    r437 r441  
    652652    } 
    653653 
    654     public function getCompiledBuilderPath ($type){ 
     654    public function getCompiledBuilderFilePath ($type){ 
    655655        return JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->module.'~'.$this->resource.'_builder_'.$type.$this->_cacheSuffix; 
    656656    } 
  • branches/experimental/jforms/lib/jelix/core/jSelector.class.php

    r437 r441  
    652652    } 
    653653 
    654     public function getCompiledBuilderPath ($type){ 
     654    public function getCompiledBuilderFilePath ($type){ 
    655655        return JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->module.'~'.$this->resource.'_builder_'.$type.$this->_cacheSuffix; 
    656656    } 
  • branches/experimental/jforms/lib/jelix/forms/jFormsBase.class.php

    r439 r441  
    201201    /** 
    202202     * @param string $buildertype  the type name of a form builder 
     203     * @param string $action action selector where form will be submit 
     204     * @param array $actionParams  parameters for the action 
    203205     * @return jFormsBuilderBase 
    204206     */ 
    205     public function getBuilder($buildertype){ 
     207    public function getBuilder($buildertype, $action, $actionParams){ 
    206208        if(isset($this->_builders[$buildertype])){ 
     209            include_once(JELIX_LIB_FORMS_PATH.'jFormsBuilderBase.class.php'); 
    207210            include_once ($this->_builders[$buildertype][0]); 
    208211            $c =  $this->_builders[$buildertype][1]; 
    209             return new $c($this); 
     212            return new $c($this, $action, $actionParams); 
    210213        }else{ 
    211214            throw new Exception('invalid form builder type'); 
  • branches/experimental/jforms/lib/jelix/forms/jFormsBase.class.php

    r439 r441  
    201201    /** 
    202202     * @param string $buildertype  the type name of a form builder 
     203     * @param string $action action selector where form will be submit 
     204     * @param array $actionParams  parameters for the action 
    203205     * @return jFormsBuilderBase 
    204206     */ 
    205     public function getBuilder($buildertype){ 
     207    public function getBuilder($buildertype, $action, $actionParams){ 
    206208        if(isset($this->_builders[$buildertype])){ 
     209            include_once(JELIX_LIB_FORMS_PATH.'jFormsBuilderBase.class.php'); 
    207210            include_once ($this->_builders[$buildertype][0]); 
    208211            $c =  $this->_builders[$buildertype][1]; 
    209             return new $c($this); 
     212            return new $c($this, $action, $actionParams); 
    210213        }else{ 
    211214            throw new Exception('invalid form builder type'); 
  • branches/experimental/jforms/lib/jelix/forms/jFormsBuilderBase.class.php

    r437 r441  
    3939 
    4040    /** 
     41     * form name 
     42     */ 
     43    protected $_name; 
     44 
     45    /** 
    4146     * @param jFormsBase $form a form object 
    4247     * @param string $action action selector where form will be submit 
     
    4752        $this->_action = $action; 
    4853        $this->_actionParams = $actionParams; 
     54        $this->_name = jFormsBuilderBase::generateFormName(); 
    4955    } 
    5056 
     
    5460    abstract public function outputFooter(); 
    5561 
    56     public static function getFormName(){ 
     62    public static function generateFormName(){ 
    5763        static $number = 0; 
    5864        $number++; 
     
    6672        $url = jUrl::get($this->_action, $this->_actionParams, 2); // retourne le jurl correspondant 
    6773 
    68         echo '<form action="'.$url->scriptName . $url->pathInfo.'" method="POST" name="'. jFormsBuilderBase::getFormName().'">'; 
     74        echo '<form action="'.$url->scriptName . $url->pathInfo.'" method="POST" name="'. $this->_name.'">'; 
    6975        if(count($url->params)){ 
    7076            echo '<div>'; 
  • branches/experimental/jforms/lib/jelix/forms/jFormsBuilderBase.class.php

    r437 r441  
    3939 
    4040    /** 
     41     * form name 
     42     */ 
     43    protected $_name; 
     44 
     45    /** 
    4146     * @param jFormsBase $form a form object 
    4247     * @param string $action action selector where form will be submit 
     
    4752        $this->_action = $action; 
    4853        $this->_actionParams = $actionParams; 
     54        $this->_name = jFormsBuilderBase::generateFormName(); 
    4955    } 
    5056 
     
    5460    abstract public function outputFooter(); 
    5561 
    56     public static function getFormName(){ 
     62    public static function generateFormName(){ 
    5763        static $number = 0; 
    5864        $number++; 
     
    6672        $url = jUrl::get($this->_action, $this->_actionParams, 2); // retourne le jurl correspondant 
    6773 
    68         echo '<form action="'.$url->scriptName . $url->pathInfo.'" method="POST" name="'. jFormsBuilderBase::getFormName().'">'; 
     74        echo '<form action="'.$url->scriptName . $url->pathInfo.'" method="POST" name="'. $this->_name.'">'; 
    6975        if(count($url->params)){ 
    7076            echo '<div>'; 
  • branches/experimental/jforms/lib/jelix/forms/jFormsCompiler.class.php

    r439 r441  
    3232      $this->sourceFile = $selector->getPath(); 
    3333      $cachefile = $selector->getCompiledFilePath(); 
    34       $cacheHtmlBuilderFile = $selector->getCompiledBuildFilePath ('html'); 
     34      $cacheHtmlBuilderFile = $selector->getCompiledBuilderFilePath ('html'); 
    3535 
    3636      // compilation du fichier xml 
    37       $xml = simplexml_load_file ( $sourceFile); 
     37      $xml = simplexml_load_file ( $this->sourceFile); 
    3838      if(!$xml){ 
    39          return false
     39         throw new jException('jelix~formserr.invalid.xml.file',array($this->sourceFile))
    4040      } 
    4141 
     
    5555      $source[]='          parent::__construct($container, $reset); '; 
    5656 
    57  
    5857      $srcHtmlBuilder=array(); 
    5958      $srcHtmlBuilder[]='<?php class '.$selector->getClass().'_builder_html extends jFormsHtmlBuilderBase {'; 
    60       $srcHtmlBuilder[]=' public function __construct($form, $action){'; 
    61       $srcHtmlBuilder[]='          parent::__construct($form, $action); '; 
     59      $srcHtmlBuilder[]=' public function __construct($form, $action, $actionParams){'; 
     60      $srcHtmlBuilder[]='          parent::__construct($form, $action, $actionParams); '; 
    6261      $srcHtmlBuilder[]='  }'; 
    6362 
    6463      $srcjs=array(); 
    65  
    66  
     64      $srcjs[]='$js="gForm = new jFormsForm(\'".$this->_name."\');\n";'; 
     65      $srcjs[]='$js.="gForm.setDecorator(new jFormsErrorDecoratorAlert());\n";'; 
    6766      foreach($xml->children() as $controltype=>$control){ 
    6867            $source[] = $this->generatePHPControl($controltype, $control); 
    6968            $srcjs[] =  $this->generateJsControl($control); 
    7069      } 
    71  
    7270      $source[]='  }'; 
    7371 
     
    7775 
    7876      jFile::write($cachefile, implode("\n", $source)); 
    79  
     77      $srcjs[]='$js.="jForms.declareForm(gForm);\n";'; 
    8078 
    8179      $srcHtmlBuilder[]=' public function getJavascriptCheck(){'; 
     
    8583 
    8684      jFile::write($cacheHtmlBuilderFile, implode("\n", $srcHtmlBuilder)); 
    87  
    8885      return true; 
    8986    } 
  • branches/experimental/jforms/lib/jelix/forms/jFormsCompiler.class.php

    r439 r441  
    3232      $this->sourceFile = $selector->getPath(); 
    3333      $cachefile = $selector->getCompiledFilePath(); 
    34       $cacheHtmlBuilderFile = $selector->getCompiledBuildFilePath ('html'); 
     34      $cacheHtmlBuilderFile = $selector->getCompiledBuilderFilePath ('html'); 
    3535 
    3636      // compilation du fichier xml 
    37       $xml = simplexml_load_file ( $sourceFile); 
     37      $xml = simplexml_load_file ( $this->sourceFile); 
    3838      if(!$xml){ 
    39          return false
     39         throw new jException('jelix~formserr.invalid.xml.file',array($this->sourceFile))
    4040      } 
    4141 
     
    5555      $source[]='          parent::__construct($container, $reset); '; 
    5656 
    57  
    5857      $srcHtmlBuilder=array(); 
    5958      $srcHtmlBuilder[]='<?php class '.$selector->getClass().'_builder_html extends jFormsHtmlBuilderBase {'; 
    60       $srcHtmlBuilder[]=' public function __construct($form, $action){'; 
    61       $srcHtmlBuilder[]='          parent::__construct($form, $action); '; 
     59      $srcHtmlBuilder[]=' public function __construct($form, $action, $actionParams){'; 
     60      $srcHtmlBuilder[]='          parent::__construct($form, $action, $actionParams); '; 
    6261      $srcHtmlBuilder[]='  }'; 
    6362 
    6463      $srcjs=array(); 
    65  
    66  
     64      $srcjs[]='$js="gForm = new jFormsForm(\'".$this->_name."\');\n";'; 
     65      $srcjs[]='$js.="gForm.setDecorator(new jFormsErrorDecoratorAlert());\n";'; 
    6766      foreach($xml->children() as $controltype=>$control){ 
    6867            $source[] = $this->generatePHPControl($controltype, $control); 
    6968            $srcjs[] =  $this->generateJsControl($control); 
    7069      } 
    71  
    7270      $source[]='  }'; 
    7371 
     
    7775 
    7876      jFile::write($cachefile, implode("\n", $source)); 
    79  
     77      $srcjs[]='$js.="jForms.declareForm(gForm);\n";'; 
    8078 
    8179      $srcHtmlBuilder[]=' public function getJavascriptCheck(){'; 
     
    8583 
    8684      jFile::write($cacheHtmlBuilderFile, implode("\n", $srcHtmlBuilder)); 
    87  
    8885      return true; 
    8986    } 
  • branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifacl.php

    r312 r441  
    33* @package    jelix 
    44* @subpackage jtpl_plugin 
    5 * @version    $Id$ 
    65* @author     Jouanneau Laurent 
    7 * @copyright  2006 Jouanneau laurent 
    8 * @link        http://www.jelix.org 
     6* @copyright  2006-2007 Jouanneau laurent 
     7* @link       http://www.jelix.org 
    98* @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    109*/ 
     
    1615 * @param jTplCompiler $compiler the template compiler 
    1716 * @param boolean true if it is the begin of block, else false 
    18  * @param $param array  1=>subject 2=>right value 3=>optional resource 
     17 * @param $param array  0=>subject 1=>right value 2=>optional resource 
    1918 * @return string the php code corresponding to the begin or end of the block 
    2019 */ 
  • branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifacl.php

    r312 r441  
    33* @package    jelix 
    44* @subpackage jtpl_plugin 
    5 * @version    $Id$ 
    65* @author     Jouanneau Laurent 
    7 * @copyright  2006 Jouanneau laurent 
    8 * @link        http://www.jelix.org 
     6* @copyright  2006-2007 Jouanneau laurent 
     7* @link       http://www.jelix.org 
    98* @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    109*/ 
     
    1615 * @param jTplCompiler $compiler the template compiler 
    1716 * @param boolean true if it is the begin of block, else false 
    18  * @param $param array  1=>subject 2=>right value 3=>optional resource 
     17 * @param $param array  0=>subject 1=>right value 2=>optional resource 
    1918 * @return string the php code corresponding to the begin or end of the block 
    2019 */ 
  • branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifnotacl.php

    r329 r441  
    33* @package    jelix 
    44* @subpackage jtpl_plugin 
    5 * @version    $Id$ 
    65* @author     Jouanneau Laurent 
    7 * @copyright  2006 Jouanneau laurent 
    8 * @link        http://www.jelix.org 
     6* @copyright  2006-2007 Jouanneau laurent 
     7* @link       http://www.jelix.org 
    98* @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    109*/ 
     
    1615 * @param jTplCompiler $compiler the template compiler 
    1716 * @param boolean true if it is the begin of block, else false 
    18  * @param $params array  1=>subject 2=>right value 3=>optional resource 
     17 * @param $params array  0=>subject 1=>right value 2=>optional resource 
    1918 * @return string the php code corresponding to the begin or end of the block 
    2019 */ 
  • branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifnotacl.php

    r329 r441  
    33* @package    jelix 
    44* @subpackage jtpl_plugin 
    5 * @version    $Id$ 
    65* @author     Jouanneau Laurent 
    7 * @copyright  2006 Jouanneau laurent 
    8 * @link        http://www.jelix.org 
     6* @copyright  2006-2007 Jouanneau laurent 
     7* @link       http://www.jelix.org 
    98* @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    109*/ 
     
    1615 * @param jTplCompiler $compiler the template compiler 
    1716 * @param boolean true if it is the begin of block, else false 
    18  * @param $params array  1=>subject 2=>right value 3=>optional resource 
     17 * @param $params array  0=>subject 1=>right value 2=>optional resource 
    1918 * @return string the php code corresponding to the begin or end of the block 
    2019 */ 
  • branches/experimental/jforms/lib/jelix/tpl/plugins/html/block.form.php

    r437 r441  
    44* @subpackage  jtpl_plugin 
    55* @author      Jouanneau Laurent 
    6 * @copyright   2006 Jouanneau laurent 
     6* @copyright   2006-2007 Jouanneau laurent 
    77* @link        http://www.jelix.org 
    88* @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
     
    1616 * @param jTplCompiler $compiler the template compiler 
    1717 * @param boolean true if it is the begin of block, else false 
    18  * @param $param array  1=>subject 2=>right value 3=>optional resource 
     18 * @param $param array  0=>form object 1=>selector of submit action  2=>array of parameters for submit action 
    1919 * @return string the php code corresponding to the begin or end of the block 
    2020 * @see jForms 
     
    2424 
    2525    if(!$begin){ 
    26         return '$builder->outputFooter();'; 
     26        return '$builder->outputFooter(); $form = null; $builder=null;'; 
    2727    } 
    2828 
    29     if(count($param) != 3){ 
     29    if(count($param) < 2 || count($param) > 3){ 
    3030        $compiler->doError2('errors.tplplugin.block.bad.argument.number','form',2); 
    3131        return ''; 
     32    } 
     33    if(count($param) == 2){ 
     34        $param[2] = 'array()'; 
    3235    } 
    3336 
     
    3639$builder->outputHeader(); 
    3740'; 
     41 
     42    $rep = $GLOBALS['gJCoord']->response; 
     43    if($rep!= null){ 
     44        $rep->addJSLink($GLOBALS['gJConfig']->urlengine['basePath'].'jelix/js/jforms.js'); 
     45    } 
     46 
    3847    return $content; 
    3948} 
  • branches/experimental/jforms/lib/jelix/tpl/plugins/html/block.form.php

    r437 r441  
    44* @subpackage  jtpl_plugin 
    55* @author      Jouanneau Laurent 
    6 * @copyright   2006 Jouanneau laurent 
     6* @copyright   2006-2007 Jouanneau laurent 
    77* @link        http://www.jelix.org 
    88* @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
     
    1616 * @param jTplCompiler $compiler the template compiler 
    1717 * @param boolean true if it is the begin of block, else false 
    18  * @param $param array  1=>subject 2=>right value 3=>optional resource 
     18 * @param $param array  0=>form object 1=>selector of submit action  2=>array of parameters for submit action 
    1919 * @return string the php code corresponding to the begin or end of the block 
    2020 * @see jForms 
     
    2424 
    2525    if(!$begin){ 
    26         return '$builder->outputFooter();'; 
     26        return '$builder->outputFooter(); $form = null; $builder=null;'; 
    2727    } 
    2828 
    29     if(count($param) != 3){ 
     29    if(count($param) < 2 || count($param) > 3){ 
    3030        $compiler->doError2('errors.tplplugin.block.bad.argument.number','form',2); 
    3131        return ''; 
     32    } 
     33    if(count($param) == 2){ 
     34        $param[2] = 'array()'; 
    3235    } 
    3336 
     
    3639$builder->outputHeader(); 
    3740'; 
     41 
     42    $rep = $GLOBALS['gJCoord']->response; 
     43    if($rep!= null){ 
     44        $rep->addJSLink($GLOBALS['gJConfig']->urlengine['basePath'].'jelix/js/jforms.js'); 
     45    } 
     46 
    3847    return $content; 
    3948} 
  • branches/experimental/jforms/testapp/modules/testapp/controllers/sampleform.classic.php

    r436 r441  
    33* @package     testapp 
    44* @subpackage  testapp module 
    5 * @version     $Id$ 
    65* @author      Jouanneau Laurent 
    76* @contributor 
    8 * @copyright   2005-2006 Jouanneau laurent 
     7* @copyright   2005-2007 Jouanneau laurent 
    98* @link        http://www.jelix.org 
    109* @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
     
    3130 
    3231      $tpl = new jTpl(); 
    33       $tpl->assign('form', $form->getContainer()); 
     32      $tpl->assign('form', $form); 
    3433      $rep->body->assign('MAIN',$tpl->fetch('sampleform')); 
    3534      $rep->body->assign('page_title','formulaires'); 
  • branches/experimental/jforms/testapp/modules/testapp/controllers/sampleform.classic.php

    r436 r441  
    33* @package     testapp 
    44* @subpackage  testapp module 
    5 * @version     $Id$ 
    65* @author      Jouanneau Laurent 
    76* @contributor 
    8 * @copyright   2005-2006 Jouanneau laurent 
     7* @copyright   2005-2007 Jouanneau laurent 
    98* @link        http://www.jelix.org 
    109* @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
     
    3130 
    3231      $tpl = new jTpl(); 
    33       $tpl->assign('form', $form->getContainer()); 
     32      $tpl->assign('form', $form); 
    3433      $rep->body->assign('MAIN',$tpl->fetch('sampleform')); 
    3534      $rep->body->assign('page_title','formulaires'); 
  • branches/experimental/jforms/testapp/modules/testapp/templates/sampleform.tpl

    r436 r441  
    11<h1>Test de formulaire</h1> 
    22<p>Voici un formulaire de test</p> 
    3  
    4 <form action="{jurl 'sampleform_save'}" method="POST"> 
     3{form $form,'sampleform_save'} 
    54<fieldset> 
    65   <legend>Votre identité</legend> 
    7     <p><label for="nom">Nom :</label> <input type="text" name="nom" id="nom" value="{$form->datas['nom']}"/></p> 
    8     <p><label for="prenom">Prenom :</label> <input type="text" name="prenom" id="prenom" value="{$form->datas['prenom']}" /></p> 
     6    <p><label for="nom">Nom :</label> <input type="text" name="nom" id="nom" value="{$form->getData('nom')}"/></p> 
     7    <p><label for="prenom">Prenom :</label> <input type="text" name="prenom" id="prenom" value="{$form->getData('prenom')}" /></p> 
    98 
    109</fieldset> 
    1110<p><input type="submit" value="ok" /></p> 
    12 </form> 
     11{/form} 
  • branches/experimental/jforms/testapp/modules/testapp/templates/sampleform.tpl

    r436 r441  
    11<h1>Test de formulaire</h1> 
    22<p>Voici un formulaire de test</p> 
    3  
    4 <form action="{jurl 'sampleform_save'}" method="POST"> 
     3{form $form,'sampleform_save'} 
    54<fieldset> 
    65   <legend>Votre identité</legend> 
    7     <p><label for="nom">Nom :</label> <input type="text" name="nom" id="nom" value="{$form->datas['nom']}"/></p> 
    8     <p><label for="prenom">Prenom :</label> <input type="text" name="prenom" id="prenom" value="{$form->datas['prenom']}" /></p> 
     6    <p><label for="nom">Nom :</label> <input type="text" name="nom" id="nom" value="{$form->getData('nom')}"/></p> 
     7    <p><label for="prenom">Prenom :</label> <input type="text" name="prenom" id="prenom" value="{$form->getData('prenom')}" /></p> 
    98 
    109</fieldset> 
    1110<p><input type="submit" value="ok" /></p> 
    12 </form> 
     11{/form} 
Download in other formats: Unified Diff Zip Archive