Module

Developer
Supported

EE 1
EE 2
ProForm Drag and Drop Form Builder

Back to this add-on's main page
View Other Add-ons From Isaac Raway

     

You must be logged in to post.

[Resolved] Displaying the form on a page

General

therealjbriggs
therealjbriggs

I hate to admit this, but I’m completely lost on how to get a form to display on an existing template.

I pasted in the example form template and changed the tag to

{exp:proform:form form="patient_survey"

I don’t get any results even thought I’ve matched to an existing form I’ve created. Any help would be awesome!

airways
# 1
Developer
airways

Hi there,

Can you put the following into a new template or at the top of your existing template and paste the results into a reply:

Forms[ {exp:proform:forms}{form_id}{form_name}{/exp:proform:forms} ] 

This will give us a list of all of the configured forms in your system.

therealjbriggs
# 2
therealjbriggs

Here’s the link:

http://anesthesiaboise.com/careers

Glad that’s working. I think I’m just having a hard time wrapping my head around how this works. Do I need to create that forms template group to pull from?

therealjbriggs
# 3
therealjbriggs

Finally getting it… I used form_name=”” instead of form=”” and that fixed it. Thanks!

airways
# 4
Developer
airways

Generally you do not need to have an entire template group for the forms. There are many ways that forms can be set up, depending on how you build out the different URLs on your site. Here’s three ways to do it.

Method 1

If you are okay with the word “form” appearing in the URLs for your forms, you could just create one template that you link directly to for all forms. This is the simplest way to do it.

URL example: http://example.com/site/form/resume

{!-- Template Groupsite --}
{
!-- Templatesite/form --}
{exp
:proform:form form="{segment_3}"}
  
... paste in sample template contents of the proform:form tag ...
{/exp:proform:form} 


But you might not want to set things up like that, as the URLs are a bit weird with that setup. The cool thing about this method is that you don’t have to do any additional template editing when adding new forms. Just link to them and they will load correctly.

Method 2

Another way is to use an embed template. I usually put this in a forms template group, but you could put it in a global or site template group.

URL example: http://example.com/jobs/application

{!-- Template Groupjobs --}
{
!-- Templatejobs/application --}

... other template code ...

{!-- pull in the shared template which is used for all forms --}
{embed
="forms/_basic" form="resume"}

... other template code ... 
{!-- Template Groupforms --}
{
!-- Templateforms/_basic --}
{exp
:proform:form form="{embed:form}"}
  
... paste in sample template contents of the proform:form tag ...
{/exp:proform:form} 


Method 3

The last way to do it is using a custom field. This is how we do it with most of our own sites.

Basically what you would do is create a new channel field to allow you to enter the form’s name for each page. Normally it would be set to be blank, but on the pages where you want a form to show up you would specify the form’s name in that field. You can use the DT-ProForm-Select fieldtype to provide a dropdown of available form names, or use SP Table Select, or just use a plain text field.

After you have that setup, you would add code in the template used to render each page. This is great if you are already using a single template for all your pages. For example, we use Structure a lot, so this works really well for us. You could also do something similar by passing the form name field to a footer template or other embed, which you then always include in all your other templates.

Assuming that this layout template is named layouts/pages and the field for specifying the form is named “pages_form_name”, we would do the following:

URL example: http://example.com/jobs/application

{!-- Template Grouplayouts --}
{
!-- Templatelayouts/pages --}
{exp
:channel:entries ... params here ...}
{if pages_form_name}{
!-- if a form has been selected, include the shared template --}
{embed
="forms/_basic" form="{pages_form_name}"}
{
/if}
{
/exp:channel:entries} 
airways
# 5
Developer
airways

Cool, let me know if you have any issues still.