[Typo3-dev] Using $cObj->FORM()

Christian Tauscher Christian.Tauscher at freenet.de
Fri Aug 26 14:06:28 CEST 2005



Saurabh Nanda schrieb:

> I wanted to use $this->cObj->FORM() function to create/edit forms rapidly.
> $this->cObj->FORM('Name | name=input,25 || Submit | submit');
> But the above statement did not work. I tried looking up the API
> documentation but could not figure out how to use this function.

I had (still have) the same problem. I tryed the same like you did and 
failed to unserstand the documentation.

I solved the Prolem like this:

I configure for my Plugin some Form. If you don't like the TS-Setup for 
forms, too, use the Form-Wizard for Contentelement "Mailform". Copy it's 
output to your TS-Setup.

My startingpoint for my TS I took from some dokumentation. I only alter 
this to my needs:

plugin.user_myplugin_pi1 {
   mailForm = FORM
   mailForm.method = POST
   mailForm.dataArray {
     10.label = Name
     10.type = name=input,40
     10.value = Your Name
     10.required = 1

     20.label = Address
     20.type = textarea,40,10

     40.label = Some checks:
     40.type = zusatz=check
     40.checked = 0

     50.value = Abschicken
     50.type = button=submit
     }

   mailForm.recipient = typo3 at kino-isny.de
   mailForm.layout = <tr><td>###LABEL###</td><td>###FIELD###</td></tr>
   mailForm.REQ=1
   mailForm.REQ.layout = <tr><td>###LABEL###(REQ!)</td><td>
   }

As you can see here my Form is pat of some bigger table-output, so aou 
should add some <tabel> | </table> wrap if you use this, or remove my 
<tr> wraps completely.

In my plugin I use this the following way:

debug($conf['mailForm.']); # To see if it's read correctly
$content .= $this->cObj->FORM(conf['mailForm.']);

Works perfectly and i is easy to change the Form via TS.

Hope this helps,

Christian.




More information about the TYPO3-dev mailing list