Changeset 608

Show
Ignore:
Timestamp:
10/05/07 22:41:43 (1 year ago)
Author:
laurentj
Message:

ticket #273: HTML forms generated by jForms can now be sent with GET method

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/forms/jFormsBuilderBase.class.php

    r606 r608  
    105105     * @param array $params some parameters 0=>name of the javascript error decorator 
    106106     *    1=> name of the javascript help decorator 
     107     *    2=> name of method 
    107108     */ 
    108109    public function outputHeader($params){ 
    109110        $url = jUrl::get($this->_action, $this->_actionParams, 2); // retourne le jurl correspondant 
    110         echo '<form action="',$url->scriptName,$url->pathInfo,'" method="POST" name="', $this->_name,'" onsubmit="return jForms.verifyForm(this)"'; 
     111        echo '<form action="',$url->scriptName,$url->pathInfo,'" method="'.$params[2].'" name="', $this->_name,'" onsubmit="return jForms.verifyForm(this)"'; 
    111112        if($this->_form->hasUpload()) 
    112113            echo ' enctype="multipart/form-data">'; 
  • trunk/lib/jelix/forms/jFormsBuilderBase.class.php

    r606 r608  
    105105     * @param array $params some parameters 0=>name of the javascript error decorator 
    106106     *    1=> name of the javascript help decorator 
     107     *    2=> name of method 
    107108     */ 
    108109    public function outputHeader($params){ 
    109110        $url = jUrl::get($this->_action, $this->_actionParams, 2); // retourne le jurl correspondant 
    110         echo '<form action="',$url->scriptName,$url->pathInfo,'" method="POST" name="', $this->_name,'" onsubmit="return jForms.verifyForm(this)"'; 
     111        echo '<form action="',$url->scriptName,$url->pathInfo,'" method="'.$params[2].'" name="', $this->_name,'" onsubmit="return jForms.verifyForm(this)"'; 
    111112        if($this->_form->hasUpload()) 
    112113            echo ' enctype="multipart/form-data">'; 
  • trunk/lib/jelix/plugins/tpl/html/block.form.php

    r602 r608  
    2121 *                     3=>name of your javascript object for error listener 
    2222 *                     4=>name of your javascript object for help listener 
     23 *                     5=>name of the method : POST or GET 
    2324 * @return string the php code corresponding to the begin or end of the block 
    2425 * @see jForms 
     
    5253        $helpdecorator = "'jFormsHelpDecoratorAlert'"; 
    5354 
     55    $method = strtoupper(isset($param[5])?$param[5]:'POST'); 
     56    if($method!='GET' && $method!='POST') 
     57        $method='POST'; 
     58 
    5459    $content = ' $t->_privateVars[\'__form\'] = '.$param[0].'; 
    5560$t->_privateVars[\'__formbuilder\'] = $t->_privateVars[\'__form\']->getBuilder(\'html\', '.$param[1].','.$param[2].'); 
    56 $t->_privateVars[\'__formbuilder\']->outputHeader(array('.$errdecorator.','.$helpdecorator.')); 
     61$t->_privateVars[\'__formbuilder\']->outputHeader(array('.$errdecorator.','.$helpdecorator.',\''.$method.'\')); 
    5762$t->_privateVars[\'__displayed_ctrl\'] = array(); 
    5863if($GLOBALS[\'gJCoord\']->response!= null){ 
  • trunk/lib/jelix/plugins/tpl/html/block.form.php

    r602 r608  
    2121 *                     3=>name of your javascript object for error listener 
    2222 *                     4=>name of your javascript object for help listener 
     23 *                     5=>name of the method : POST or GET 
    2324 * @return string the php code corresponding to the begin or end of the block 
    2425 * @see jForms 
     
    5253        $helpdecorator = "'jFormsHelpDecoratorAlert'"; 
    5354 
     55    $method = strtoupper(isset($param[5])?$param[5]:'POST'); 
     56    if($method!='GET' && $method!='POST') 
     57        $method='POST'; 
     58 
    5459    $content = ' $t->_privateVars[\'__form\'] = '.$param[0].'; 
    5560$t->_privateVars[\'__formbuilder\'] = $t->_privateVars[\'__form\']->getBuilder(\'html\', '.$param[1].','.$param[2].'); 
    56 $t->_privateVars[\'__formbuilder\']->outputHeader(array('.$errdecorator.','.$helpdecorator.')); 
     61$t->_privateVars[\'__formbuilder\']->outputHeader(array('.$errdecorator.','.$helpdecorator.',\''.$method.'\')); 
    5762$t->_privateVars[\'__displayed_ctrl\'] = array(); 
    5863if($GLOBALS[\'gJCoord\']->response!= null){ 
  • trunk/lib/jelix/plugins/tpl/html/function.formfull.php

    r547 r608  
    1919 * @param string $helpDecorator name of your javascript object for help listener 
    2020 */ 
    21 function jtpl_function_html_formfull($tpl, $form, $action, $params=array(), $errDecorator='jFormsErrorDecoratorAlert', $helpDecorator='jFormsHelpDecoratorAlert') 
     21function jtpl_function_html_formfull($tpl, $form, $action, $params=array(),  
     22        $errDecorator='jFormsErrorDecoratorAlert', $helpDecorator='jFormsHelpDecoratorAlert', $method='POST') 
    2223{ 
    2324 
    2425    $formBuilder = $form->getBuilder('html', $action, $params); 
    25     $formBuilder->outputHeader(array($errDecorator, $helpDecorator)); 
     26    $formBuilder->outputHeader(array($errDecorator, $helpDecorator, $method)); 
    2627 
    2728    if($GLOBALS['gJCoord']->response!= null){ 
  • trunk/lib/jelix/plugins/tpl/html/function.formfull.php

    r547 r608  
    1919 * @param string $helpDecorator name of your javascript object for help listener 
    2020 */ 
    21 function jtpl_function_html_formfull($tpl, $form, $action, $params=array(), $errDecorator='jFormsErrorDecoratorAlert', $helpDecorator='jFormsHelpDecoratorAlert') 
     21function jtpl_function_html_formfull($tpl, $form, $action, $params=array(),  
     22        $errDecorator='jFormsErrorDecoratorAlert', $helpDecorator='jFormsHelpDecoratorAlert', $method='POST') 
    2223{ 
    2324 
    2425    $formBuilder = $form->getBuilder('html', $action, $params); 
    25     $formBuilder->outputHeader(array($errDecorator, $helpDecorator)); 
     26    $formBuilder->outputHeader(array($errDecorator, $helpDecorator, $method)); 
    2627 
    2728    if($GLOBALS['gJCoord']->response!= null){ 
  • trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html.php

    r605 r608  
    7878        $formname = $builder->getName(); 
    7979        ob_start(); 
    80         $builder->outputHeader(array('','')); 
     80        $builder->outputHeader(array('','','POST')); 
    8181        $out = ob_get_clean(); 
    8282        $result ='<form action="'.$GLOBALS['gJConfig']->urlengine['basePath'].'index.php" method="POST" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="module" value="jelix_tests"/> 
    8383<input type="hidden" name="action" value="urlsig_url1"/> 
    8484</div><script type="text/javascript">  
    85 //<[CDATA[ 
     85//<![CDATA[ 
    8686 
    8787//]]> 
     
    9292        $formname = $builder->getName(); 
    9393        ob_start(); 
    94         $builder->outputHeader(array('','')); 
     94        $builder->outputHeader(array('','','GET')); 
    9595        $out = ob_get_clean(); 
    96         $result ='<form action="'.$GLOBALS['gJConfig']->urlengine['basePath'].'index.php" method="POST" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="foo" value="b&gt;ar"/> 
     96        $result ='<form action="'.$GLOBALS['gJConfig']->urlengine['basePath'].'index.php" method="GET" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="foo" value="b&gt;ar"/> 
    9797<input type="hidden" name="module" value="jelix_tests"/> 
    9898<input type="hidden" name="action" value="urlsig_url1"/> 
    9999</div><script type="text/javascript">  
    100 //<[CDATA[ 
     100//<![CDATA[ 
    101101 
    102102//]]> 
  • trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html.php

    r605 r608  
    7878        $formname = $builder->getName(); 
    7979        ob_start(); 
    80         $builder->outputHeader(array('','')); 
     80        $builder->outputHeader(array('','','POST')); 
    8181        $out = ob_get_clean(); 
    8282        $result ='<form action="'.$GLOBALS['gJConfig']->urlengine['basePath'].'index.php" method="POST" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="module" value="jelix_tests"/> 
    8383<input type="hidden" name="action" value="urlsig_url1"/> 
    8484</div><script type="text/javascript">  
    85 //<[CDATA[ 
     85//<![CDATA[ 
    8686 
    8787//]]> 
     
    9292        $formname = $builder->getName(); 
    9393        ob_start(); 
    94         $builder->outputHeader(array('','')); 
     94        $builder->outputHeader(array('','','GET')); 
    9595        $out = ob_get_clean(); 
    96         $result ='<form action="'.$GLOBALS['gJConfig']->urlengine['basePath'].'index.php" method="POST" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="foo" value="b&gt;ar"/> 
     96        $result ='<form action="'.$GLOBALS['gJConfig']->urlengine['basePath'].'index.php" method="GET" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="foo" value="b&gt;ar"/> 
    9797<input type="hidden" name="module" value="jelix_tests"/> 
    9898<input type="hidden" name="action" value="urlsig_url1"/> 
    9999</div><script type="text/javascript">  
    100 //<[CDATA[ 
     100//<![CDATA[ 
    101101 
    102102//]]> 
Download in other formats: Unified Diff Zip Archive