Hi all,
Why can't we add ftl expressions in hidden fields?
I rewrote [code]formHidden.ftl[/code] to be able to do so
[code][#assign hasInterpretedValue = false]
[#if content.value?has_content && content.value?starts_with(r"${")]
[#assign interpretedValue][@(content.value!'')?interpret /][/#assign]
[#assign hasInterpretedValue = true]
[/#if]
<div ${model.style!} >
<input type="hidden" name="${content.controlName}"
id="${content.controlName}" value="[#if
hasInterpretedValue]${interpretedValue!}[#elseif
content.value?has_content]${content.value!}[/#if]"/>
</div><!-- end ${model.style!} -->[/code]
An example of use would be to then add a hidden field with value
[code]${ctx.myParam!model.value!}[/code] . It will interpret a paramater called
"myParam" and pass it as the value in the form.
This param is passed via POST or GET method (that's why we have
[code]${ctx.myParam}[/code]), via GET you can test this such as
[code]yourUrl.com/yourTestPage?myParam=mySupaCoolValue[/code]
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=369ba5b0-9da0-40d6-b917-6ad38ff0d994
----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------