[TYPO3-mvc] Fluid: default values for bound properties, e.g. textarea? problem with rewrittenPropertyMapper
Andreas Kiessling
kiessling at pluspol.info
Sun Nov 20 17:06:27 CET 2011
Hi,
i'm wondering, if this is the way to go (TYPO3 4.6):
I have a form with bound properties and want to display a textarea with
a default text, if the form is initially loaded. (Don't mix that up with
"placeholder". That text should be submitted.)
The only way that worked, was to wrap it in a condition:
<f:if condition="{foo.message}">
<f:then>
<f:form.textarea rows="7" cols="30" id="message" property="message" />
</f:then>
<f:else>
<f:form.textarea rows="7" cols="30" id="message" property="message"
value="default text" />
</f:else>
</f:if>
When a "value" attribute is set, it is used regardless of any submitted
value. It doesn't really feal right, but is is usable that way.
After activating the rewrittenPropertyMapper, {foo} is not available
anymore in that context so i always end up with the "default text". This
bugreport http://forge.typo3.org/issues/31688 which says, that {foo}
should not be available at that point and to have a look at
Tx_Fluid_ViewHelpers_Form_AbstractFormFIeldViewHelper::getLastSubmittedFormData().
So to make it work, i now have a viewhelper, that checks if there is an
originalRequest set and then adds a templateVariableContainer which i
can use in the condition:
<f:if condition="{submittedValue}">
Is there another way to make this work?
Regards,
Andreas
More information about the TYPO3-project-typo3v4mvc
mailing list