[TYPO3-project-formidable] how to combine _two_ form-fields to be inserted/updated as a _single_ db-field

François SCHOSSIG fs.nospam1 at a-e-r.org
Sun Feb 4 22:28:58 CET 2007


To be able to use in the form a field without having to define it in  
the database, you have to add <renderonly>true</renderonly> in your  
renderlet.
--
F. SCHOSSIG, ICT Manager
Assemblée des Régions d'Europe
http://www.a-e-r.org


Le 29 janv. 07 à 14:47, Michael Wilde a écrit :

> Hi there,
>
> 1st Question:
> =============
>
> within my application I would like to read the values of one date  
> _and_
> one time form-field and store it together as a _single_ timestamp in a
> database. And vice versa it should be possible to read a _single_
> timestamp and display it as two seperate form fields again.
> ---------------------------------------------------------------------- 
> -
>
> The table looks as follows:
>
> uid | pid | ... | my_timestamp
> ----+-----+ ... +-------------
> 1   | 2   | ... | 1169485200
>
> within my form.xml file I've got two form-fields "my_date" and
> "my_time". "my_date" is a DATE renderlet and "my_time" is a TEXT
> renderlet. Both form-fields should be combined to a single  
> timestamp to
> be inserted into the database (--> "my_timestamp").
>
> To do so I've used beforeinsertion and beforerender processes in the
> form.xml datahandler:
>
> <process>
>    <beforeinsertion>
>      <userobj>
>        <php><![CDATA[				
>          $oThis = t3lib_div::makeInstance("tx_myapp_pi1");
>          $aData = array_pop(func_get_args());
>          return $oThis->beforeInsertationOfBirthday($aData);
>        ]]></php>
>      </userobj>
>    </beforeinsertion>		
>    <beforerender>
>      <userobj>
>        <php><![CDATA[				
>          $oThis = t3lib_div::makeInstance("tx_myapp_pi1");
>          $aData = array_pop(func_get_args());
>          return $oThis->beforeRenderOfBirthday($aData);
>        ]]></php>
>      </userobj>
>    </beforerender>	
> </process>
>
> The content of the two user-functions:
>
> function beforeInsertationOfBirthday($aData) {
>    $aData['my_timestamp'] =
>        $this->convertToTimestamp($aData['my_date'],$aData['my_time']);
>    return $aData;
> }
>
> function beforeRenderOfBirthday($aData) {
>    $aData['my_date'] = $this->convertToDate($aData['my_timestamp']);
>    $aData['my_time'] = $this->convertToTime($aData['my_timestamp']);
>    return $aData;
> }
>
> The problem here is that a valid timestamp is correctly read out of  
> the
> database and it is correctly rendered, but it is not possible to  
> insert
> a timestamp into the database. The value for "my_date" and  
> "my_time" in
> the variable $aData of beforeInsertationOfBirthday() seem to be not
> available.
>
> Everything works fine as long as the name of the form-fields are the
> same as the names of the table-columns in the database. But I can't
> figure out how to use fieldnames that do not exist in the database.
>
> This means: everything works fine for a field with the name "my_date2"
> and a table-column with the name "my_date2". Here the data is inserted
> correctly. But it is not possible for me to change the field name to
> e.g. "my_date3". Further it is not possible to use a second field
> "my_time2", combine it with "my_date2" and insert the resulting
> timestamp as "my_timestamp" into the database.
>
> Hope anyone that understood the problem can help me further on this.
>
>
> 2st Question:
> =============
>
> Is there any possibility to store dates before 1970 as timestamp  
> into a
> database using Formidable?
>
> TIA,
> Michael.
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project- 
> formidable



More information about the TYPO3-project-formidable mailing list