0

I'm using the Freeform composer tag to pull a form into an EE template, but I can't work out how to set the return value to whatever page the users puts into the Freeform channel field. It works fine if I specify a specific page in the tag.

This is my tag as it works (form_select_form is my custom field):

{exp:freeform:composer form_id="{form_select_form:form_id}" form_name="{form_select_form:form_name}" return="/message/thanks"}

What I'd like is the equivalent of:

{exp:freeform:composer form_id="{form_select_form:form_id}" form_name="{form_select_form:form_name}" return="{form_select_form:user_specified_return_page"}

Any ideas?

5
  • Are you using the channel entry fieldtype?
    – Solspace
    Mar 25 '14 at 14:16
  • Yes I am - sorry should have mentioned that! I might be trying to do two (or possibly three) things at once. I want to use the channel entry fieldtype so that I can keep my form code in an EE template rather than using a composer template, I want to use the options (admin user notifications and templates) from composer, and I'd like to use the return value specified in the channel field to redirect users after submission.
    – tomjeatt
    Mar 25 '14 at 14:37
  • Also, by users I mean the people creating the forms, rather than the ones filling them in.
    – tomjeatt
    Mar 25 '14 at 14:41
  • So form_select_form is a Freeform custom channel field? In that case, it should be called from within {exp:channel:entries} by simply using the field's name like this: {form_select_form}. This would output your selected Composer form in the channel entry.
    – Solspace
    Mar 28 '14 at 2:48
  • Yes, I got that bit and I can get that working without any problems, but that also means that I have to use a composer template doesn't it? I'd prefer to use an ExpressionEngine template so that I can keep the form code with the rest of my site's code.
    – tomjeatt
    Mar 28 '14 at 14:23
0

Currently, you can't. Also "{form_select_form:form_name}" isn't a valid variable. Where you have:

form_id="{form_select_form:form_id}" 

Which is valid, this is doing the work of form_name="" already, thus you are seeing no error. So even if it did work, it would be redundant.

I've added a feature request for a better way to accomplish this scenario, but one thing you could try is editing:

./system/expressionengine/third_party/freeform/ft.freeform.php

around line 232 there is:

ee()->TMPL->tagdata     = '';

Which is a hack to allow the module's composer setup to work as params passed into the channel entries tag for the Freeform field are passed as tagparams to TMPL.

Try editing line 232 to look like:

ee()->TMPL->tagdata     = $tagdata;

Then around line 32, set:

public $has_array_data  = FALSE;

to:

public $has_array_data  = TRUE;

This should pass any incoming tagdata towards composer let you put your composer data between field variable pairs like so:

{form_select_form}
    //composer tags
{/form_select_form}

I will add this to feature requests and see what we can do sometime in the future about making this part of Freeform.

1
  • Thanks for the detailed answer - I appreciate it. I don't want to hack the module (just in case the next person who updates it isn't me!), so I'll stick with the composer template for now and look out for this in a future release.
    – tomjeatt
    Apr 1 '14 at 8:04

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.