0

I need to show all forms on one page dynamically.

I'm doing this:

{exp:freeform:form form_name="one-of-my-forms"}
{freeform:all_form_fields}
    <label>{freeform:field_label}</label>
    {freeform:field_output}
{/freeform:all_form_fields}
<p>{freeform:submit}</p>
{/exp:freeform:form}

But as you can see, I've specified a form_name.

How do I get ALL forms without knowing how many there are..?

1
  • Is there a technical requirement to list all of the forms on one page? It sounds terribly inefficient. I think you might be better off using the freeform:form_info tag to list out your forms. Then open each form in their own page using the code you have above and replacing form_name with a segment variable. Aug 15 '13 at 15:36
0

The Freeform info tag pair, when used without a form_name or form_id param, outputs a list of the available forms. You may be able to use this loop to allow you to pull each form one after the other - with stash, you could stash the list of form IDs and then use them to output each form with its respective ID. Simplified view below:

{exp:stash:set_list name="freeform_ids" parse_tags="yes"}
    {exp:freeform:form_info}
        {stash:the_form_id}{freeform:form_id}{/stash:the_form_id}
    {/exp:freeform:form_info}
{/exp:stash:set_list}

And then later in the parse order:

{exp:stash:get_list name="freeform_ids"}
    {exp:freeform:form form_id="{the_form_id}"}
        {freeform:all_form_fields}
            <label>{freeform:field_label}</label>
            {freeform:field_output}
        {/freeform:all_form_fields}
        <p>{freeform:submit}</p>
    {/exp:freeform:form}
{/exp:stash:get_list}

That would output a "list" of your forms for each stashed form ID.

3
  • I get this error: The following tag has a syntax error: {exp:stash:set_list} is Stash a plugin that google doesn't want to tell me about?
    – Beertastic
    Aug 13 '13 at 15:06
  • Ended up doing: {exp:freeform:form_info} {exp:freeform:form form_name="{freeform:form_name}" form:id="ajax_form"} ..... Didn't use 'Stash'
    – Beertastic
    Aug 13 '13 at 15:25
  • Yes, sorry, stash is a free add-on available on devot-ee.com. Aug 13 '13 at 16:05

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.