[TYPO3-formidable] Edit form

Domi Garms djgarms at gmail.com
Fri Aug 20 16:19:35 CEST 2010


Hello,

Im also quite new in formidable, so for 2 tables I splitted into 2
forms, for getting 2 tables updated and inserted. Or If you have mm
relations you can use the mm relation extension.

One small snippet:

my datahandler:

	<datahandler:DB>
			<tablename>tx_myextension_admin</tablename>
			<keyname>uid</keyname>
			<process>
				<beforeCreation>
					<userobj>
						<php><![CDATA[
							// creation
							// TODO: pid handling
							$aData = $this->getParams();
							$aData["pid"] = 111;
							$aData["crdate"] = time();
							$aData["tstamp"] = time();
							$aData["feuser"] = $GLOBALS['TSFE']->fe_user->user['uid'];
							
							return $aData;
						]]></php>
					</userobj>
				</beforeCreation>
				<beforeEdition>
					<userobj>
						<php><![CDATA[
							// update
							// changing tstamp
							$aData = $this->getParams();
							$aData["tstamp"] = time();
			
							return $aData;
						]]></php>
					</userobj>
				</beforeEdition>
			</process>
		</datahandler:DB>

one image upload with validator:

		<renderlet:UPLOAD label="Select an image file, &lt; 2 MB">
			<name>picture</name>
			<data targetDir="uploads/tx_dmfaupairs/" multiple="true" />	
			<validators>
				<validator:FILE>
					<extension value="jpg,jpeg,gif,png" message="Only jpg, jpeg png
and gif is allowed." />
					<filesizeKB value="2048" message="Image should weight under 512KB" />
				</validator:FILE>
			</validators>
		</renderlet:UPLOAD>

you have to take care of names in the renderlets. Just try, Im sure
you can get it work quickly. All the aData names have to be column
names, as well as the renderlet: names.

Greetings
Domi



2010/8/20 Michael Paffrath <michael.paffrath at gmail.com>:
> Hi Domi,
>
> thanks for your answer.
> I actually need to update 2 tables.
> But if you could give me an example for the <datahandler:DB> way that
> would be helpful.
> I tried http://formidable.typo3.ug/reference/control/datahandlerdb.html
> but without success.
>
> Greetings,
> Michael
>
> On Fri, Aug 20, 2010 at 4:01 PM, Domi Garms <djgarms at gmail.com> wrote:
>> Hello Michael,
>>
>> for an edit or update for one table, you should use the
>> <datahandler:DB> in the <control> section. It is much easier, you can
>> insert and update easily all columns in your database.
>>
>> If you have any trouble, just ask
>>
>> Greetings
>>
>> Domi
>>
>> 2010/8/20 Michael Paffrath <michael.paffrath at gmail.com>:
>>> Hi everyone,
>>>
>>> i am trying to build a form to edit records in the backend.
>>> So far so good, but i don´t get the validation to work.
>>>
>>> Any suggestions what to do or what i could/should do better are welcome!
>>>
>>> Here is my code:
>>>
>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>> <formidable version="1.0.182">
>>>
>>>        <meta>
>>>                <name>List of userconfig</name>
>>>                <form formid="list_of_userconfig" />
>>>                <debug>false</debug>
>>>                <displaylabels>false</displaylabels>
>>>        </meta>
>>>
>>>        <control>
>>>
>>>                <datahandler:STANDARD />
>>>                <renderer:STANDARD />
>>>
>>>                <actionlets>
>>>                        <actionlet:USEROBJ>
>>>                                <userobj>
>>>                                        <php><![CDATA[/*<?php*/
>>>                                                // write data to db ... tbd
>>>                                        /*?>*/]]></php>
>>>                                </userobj>
>>>                        </actionlet:USEROBJ>
>>>                </actionlets>
>>>
>>>                <datasources>
>>>                        <datasource:DB name="userconfig">
>>>                                <sql>
>>>                                        <userobj>
>>>                                                <php><![CDATA[
>>>                                                        $sql = 'SELECT * FROM
>>>                                                                        be_users bu,
>>>                                                                        tx_3moink_userconfig mu WHERE
>>>                                                                        bu.uid = '.$GLOBALS['BE_USER']->user['uid'].' AND
>>>                                                                        mu.uid_foreign = '.$GLOBALS['BE_USER']->user['uid'];
>>>                                                        return $sql;
>>>                                                ]]></php>
>>>                                        </userobj>
>>>                                </sql>
>>>                        </datasource:DB>
>>>                </datasources>
>>>
>>>        </control>
>>>
>>>        <elements>
>>>
>>>                <renderlet:LISTER name="userconfig-list">
>>>                        <template>
>>>                                <path>EXT:3moink/formidable/edit_user_data.html</path>
>>>                                <subpart>###LIST###</subpart>
>>>                                <errortag>error</errortag>
>>>                                <alternaterows>###ROW###</alternaterows>
>>>                        </template>
>>>                        <pager>
>>>                                <rows perpage="1"/>
>>>                        </pager>
>>>                        <datasource use="userconfig" />
>>>                        <columns>
>>>                                <column name="email" listHeader="email" type="renderlet:TEXT"
>>> activelistable="true">
>>>                                        <validators>
>>>                                                <validator:STANDARD>
>>>                                                        <required message="Please provide an email adress." />
>>>                                                        <email message="Email address not valid"/>
>>>                                                </validator:STANDARD>
>>>                                        </validators>
>>>                                        <data>
>>>                                                <value>
>>>                                                        <userobj>
>>>                                                                <php><![CDATA[/*<?php*/
>>>                                                                        $aRowData = $this->oDataHandler->_getListData();
>>>                                                                        return $aRowData['email'];
>>>                                                                /*?>*/]]></php>
>>>                                                        </userobj>
>>>                                                </value>
>>>                                        </data>
>>>                                </column>
>>>                        </columns>
>>>                </renderlet:LISTER>
>>>
>>>                <renderlet:SUBMIT name="save" label="save">
>>>                </renderlet:SUBMIT>
>>>
>>>        </elements>
>>>
>>> </formidable>
>>>
>>> Thanks for the help in advance,
>>> Michael
>>> _______________________________________________
>>> TYPO3-project-formidable mailing list
>>> TYPO3-project-formidable at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-formidable
>> _______________________________________________
>> TYPO3-project-formidable mailing list
>> TYPO3-project-formidable at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-formidable
>>
>
>
>
> --
> Michael Paffrath
>
> Vrolikstraat 359 C
> 1092 TB Amsterdam
> +31 (0)6 12297498
> michael at michaelpaffrath.com
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-formidable


More information about the TYPO3-project-formidable mailing list