[TYPO3-project-formidable] Form submit: Write in different DB tables

Hauke Hain newgrp at googlemail.com
Wed Feb 25 22:13:52 CET 2009


Hi,

I don't know how to write my form values into the database in different 
fields if all validators say: go!
The only thing I found is this:
http://lists.netfielders.de/pipermail/typo3-project-formidable/2006-December/000162.html

I have different TEXT renderlets, a Selector and a TinyMCE.
With beforeinsertion I'll check if the data is ok and with afterinsertion I 
want to write in another table some statistic stuff.
The content of the different renderlets have to be saved in different fields 
of the table. My problem is, that I don't know how to say formidable which 
renderlet content (name xy) should be saved in which database field.

Here an excerpt of my XML-file:
 <control>
  <datahandler:DB>
     <tablename>tx_preview_previews</tablename>
     <keyname>title</keyname>
     <labelname>previewTitle</labelname>
     <process>
       <beforeinsertion>
      <userobj>
        <php><![CDATA[
     //get form values
     $aData = array_pop(func_get_args());
     debug($aData,'data before');

     //create anonymous function for stripping tags
     $sanitize = create_function ('&$value, $key', '$value =
strip_tags ($value);');

     //apply anonymous strip tags function to every form field
     array_walk ($aData, $sanitize);
     debug($aData,'data after');
     return $aData;
    ]]></php>
      </userobj>
       </beforeinsertion>
         <beforeCreation>
             <userobj>
                 <php><![CDATA[

                     // create
                     // adding cruser, crdate and tstamp
                     $aData = $this->getParams();

                     $aData["cruser"] = 343; //todo: get from page
                     $aData["crdate"] = time();
                     $aData["tstamp"] = time();

                     return $aData;

                 ]]></php>
             </userobj>
        </beforeCreation>
     </process>
    </datahandler:DB>

  <renderer:TEMPLATE>
   <template
    path="EXT:preview/res/tmpl/preview.html"
    subpart="###MAIN###"
   />
  </renderer:TEMPLATE>
 </control>

I don't know whats wrong, but nothing happens.

Why isn't a tutorial available for this problem?

I hope somebody can explain it to me.

Sincerely,
Hauke

PS: I hope my text is comprehendible. 



More information about the TYPO3-project-formidable mailing list