[TYPO3-mvc] use object-data in formhandler

Johannes C. Schulz - EnzephaloN IT-Solutions info at enzephalon.de
Tue Jul 26 19:06:38 CEST 2011


Hi Sebastian

It looked easier, than it is.
I've made the following changes:

the fluid-template of my extension:
[...]
<f:cObject typoscriptObjectPath="plugin.Tx_Formhandler"
data="{teaseritem.title}" currentValueKey="ttitle" />
<f:cObject typoscriptObjectPath="plugin.Tx_Formhandler"
data="{teaseritem.subtitle}" currentValueKey="tsubtitle" />
<f:cObject typoscriptObjectPath="plugin.Tx_Formhandler"
data="{teaseritem.price}" currentValueKey="tprice" />
[...]

the typoscript-file of formhandler:
plugin.Tx_Formhandler.settings.predef.default {
[...]
#cObject aus Teaserextension
  preProcessors {
    1.class = Tx_Formhandler_PreProcessor_LoadDefaultValues
    1.config {
        1 {
          value_ttile.defaultValue = ttitle
          value_tsubtitle.defaulTvalue = tsubtitle
          value_tprice.defaultValue = tprice
        }
    }
  }
[...]

And the formhandler-template:
[...]
<input type="hidden" name="formhandler[ttitle]" value="###value_ttitle###"
/>
<input type="hidden" name="formhandler[tsubtitle]"
value="###value_tsubtitle###" />
<input type="hidden" name="formhandler[tprice]" value="###value_tprice###"
/>
[...]

But if I check the source in browser, the values are empty.
Did I set the typoscriptObjectPath right?
What is wrong?

Best Regards
Johannes C. Schulz
__________________________________

-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org
[mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von
Sebastian Schreiber
Gesendet: Donnerstag, 21. Juli 2011 22:01
An: TYPO3 v4 MVC project
Betreff: Re: [TYPO3-mvc] use object-data in formhandler

Hi Johannes,
i think the easiest way to achieve it, is to use the cObjectViewHelper.
Pass your object as the data parameter and use the preProcessors settings of
the formhandler.

Example:
Fluid-Template:
<f:cObject typoscriptObjectPath="lib.formhandler" data="{entry}" 
currentValueKey="title" />

Your TS
lib.formhandler < plugin.tx_formhandler_pi1 lib.formhandler.settings {
    templateFile = fileadmin/formhandler/template.html
    preProcessors {
         1.class = Tx_Formhandler_PreProcessor_LoadDefaultValues
         1.config {
            1 {
                             firstname.defaultValue = TEXT
                             firstname.defaultValue.field = title // Could
be any accesible property of your domain model
            }
        }
    }
}

Good luck.


Am 21.07.2011 20:09, schrieb Johannes C. Schulz [EnzephaloN IT-Solutions]:
>   Formhandler is extension that followed mailform plus.
> If I add a formfield to my fluid-template, its outside of the fieldset
which is generated by formhandler. So it will not be processed.
> Any other ideas?
>
>
> Johannes C. Schulz
>
> Von Samsung Mobile gesendet
>
> Pankaj Lele<pankaj at lelesys.com>  hat geschrieben:
>
>> Hello Johannes,
>>
>>> Now I try to get an onject-data (like item.name) into a 
>>> formhandler-input-field.
>> Not sure what the formhandler-plugin means. However if you looking 
>> for showing the object inside a form you can try following in the 
>> Fluid template of single view:
>>
>> <f:form name="myForm" action="someAction" object="{item}"> 
>> <f:form.textfield property="name" /> </f:form>
>>
>> So in place of the line 2 above, you will see a text input with the 
>> value from item.name filled in.
>>
>> Hope that helps.
>>
>>
>> --
>>
>> With best regards,
>> Pankaj Lele
>> ---------------------------
>>
>> CTO&  Executive Director
>> Lelesys Infotech Pvt. Ltd.
>> Pune/Goa, India
>>
>> Web: http://www.lelesys.com
>>
>> [Certified TYPO3 Integrator]
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list 
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4
>> mvc
>>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4m
> vc


--
Sebastian Schreiber
(Medieninformatiker)
(TYPO3 Certified Integrator)

Sülzburgstraße 36
D-50937 Köln

T  0221 677 88 541
M  0176 431 05 790

Skype schreibersebastian.de

me at schreibersebastian.de
www.schreibersebastian.de

Steuernummer: 219 / 5302 / 2302

_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc




More information about the TYPO3-project-typo3v4mvc mailing list