0

I have an existing site with a good number of forms that use Freeform, currently coded directly into the templates. I'd like to pull them out of the templates and into low variable fields, then call them to a page either via (a) using a segment or (b) via a field in a channel entry.

Setting up the variable works fine, and if I tick the parse early box and code it directly into the template the form displays great. However, when I try to use a segment variable or channel fieldtype to display it the form tags do not get parsed.

So for example, if I set up a variable called "form-my-page", and code it directly into my template as:

{form-my-page}

Works great.

If I try to do something like:

{form-{segment-2}}

Doesn't parse.

Or if I attempt to use a fieldtype to attach a form to a channel entry, I find I'm unable to use early-parsed variables, and otherwise the form data doesn't get parsed.

I realized that I could use Solspace's new composer and fieldtype, but I don't want to have to redo all my custom forms right now. Thanks for any insight!

2

You can do this in two ways, both require that you turn off early parsing for the form variables, and assuming you're using regular Textarea LVs. Once turned off, use the tag syntax instead of the variable syntax, thus:

{exp:low_variables:single var="form-{segment_2}"}

The variables should now turn up in the LV Fieldtype as well, so you can use the fieldtype in combination with the tag syntax as well:

{exp:low_variables:single var="{my_low_variables_custom_field_name}"}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.