[TYPO3-project-formidable] New formwrap option

Manuel Rego Casasnovas mrego at igalia.com
Wed Jul 18 14:04:55 CEST 2007


Hello everyone,

I use FORMidable to show data a lot of times, not to make a form, with
all my renderlets in renderonly.

For this I've added a new option "/meta/formwrap" to use in my XML
files. The default value for this option is TRUE. An exmample:
    <meta>
        <name>My form</name>
        <form formid="my_form" />
        <debug>false</debug>
        <formwrap>false</formwrap>
    </meta>


To add this new option I've modified the class mainrenderer
(http://test.kunstvaerker.dk/html/class_8mainrenderer_8php-source.html#l00022):
            $formWrap= (!$this->oForm->_isFalse("/meta/formwrap"));
            $this->_setFormWrap($formWrap);

            if($this->oForm->bSubform) {
                $this->_setFormWrap($formWrap);
                $this->_setValidation(FALSE);
            }


And a little changes to remove some inputs in the forms in wich I
disable this option.

And these lines
(http://test.kunstvaerker.dk/html/class_8mainrenderer_8php-source.html#l00092):
            $aHtmlBag =
            array(
                "SCRIPT"        => "",
                "FORMBEGIN"        => "",
                "CONTENT"        => $html,
                "HIDDEN"        => "",
                "FORMEND"        => "",
            );
           
            if($this->bFormWrap) {
                $aHtmlBag["HIDDEN"] = $hidden_entryid . $hidden_custom .
$sSysHidden;
               
                $formid            = "";
                $formaction        = "";
                $formonsubmit    = "";
                $formmethod        = "";
                $formcustom        = "";
               
                $formid = " id=\"" . $this->oForm->formid . "\" name=\""
. $this->oForm->formid . "\" ";

                if(($sAction =
$this->oForm->_navConf("/meta/form/action")) !== FALSE) {
                    $formaction = " action=\"" . htmlentities($sAction)
. "\" ";
                } else {
                    $formaction = " action=\"" . 
htmlentities(t3lib_div::getIndpEnv("TYPO3_REQUEST_URL")) . "\" ";
                }

                if(($sOnSubmit =
$this->oForm->_navConf("/meta/form/onsubmit")) !== FALSE) {
                    $formonsubmit = " onSubmit = \"" . $sOnSubmit . "\" ";
                }

                if(($sCustom =
$this->oForm->_navConf("/meta/form/custom")) !== FALSE) {
                    $formcustom = " " . $sCustom . " ";
                }
               
                $aHtmlBag["FORMBEGIN"]    =    "<form
enctype=\"multipart/form-data\" " . $formid . $formaction .
$formonsubmit . $formcustom . " method=\"post\">";
                $aHtmlBag["FORMEND"]    =    "</form>";
            }


And moreover I've had to change a line in the class tx_ameosformidable:
        if($this->bFormWrap) {
            $sDomApi = '<script
type="text/javascript">if(!Formidable.Dom.bDomApiLoaded) {
Formidable.Dom.bDomApiLoaded = true;}</script>';
        }
But this line doesn't exist in the last FORMidable version.


I think that this can be a interesting option. Maybe a option to specify
that all the form is renderonly without insert the renderonly option in
all the  rederlets of the form.


Best regards,
   Rego

-- 
Manuel Rego Casasnovas
Computer Science Engineer
mailto:mrego at igalia.com
Tel: +34 986 10 76 10
Fax: +34 981 91 39 49
Igalia - http://www.igalia.com


More information about the TYPO3-project-formidable mailing list