Form Publishing Options

How to work with the HTML directly

  1. First, login to your formassembly.com account, go to the 'forms' tab and click on the form you need to set up. This opens the form properties panel on the right-hand side.
  2. In the "Publish" tab, 'Option 2' section, copy the content of the text box (or click the "Download it" link and open the HTML file in your HTML editor).
  3. Using your favorite web editor, create a new page on your site and paste the HTML. When doing this, make sure that you are editing the HTML code directly (you should be able to see and edit the HTML tags).
  4. When copy and pasting, you will notice that the HTML starts with:
    <!-- FORM: HEAD SECTION -->,
    and further down, there's
    <!-- FORM: BODY SECTION -->
    Ideally, you will want to place the HTML between these two comments before the closing </HEAD> tag in your page.
    If this is confusing, just ignore this particular instruction, it should work anyway.
  5. Upload the page (if applicable) and test. You should be able to see the form, submit it, and the form validation should work (ie. you should see an error if a required field is left empty).

How to dynamically prefill your form fields

You can dynamically assign a value to any field in your form by adding specific parameters to the link that points to your form.
The general format is : http://link/to/your/form?FIELD_NAME=FIELD_VALUE

To find the exact syntax for all the fields in your form,

  1. Go to the "My Forms" and click on the form you need to set up. This opens the form properties panel on the right-hand side.
  2. In the "Publish" tab, click the "Show how to prefill form data dynamically" link.

How to use a server-side script to display the form (API)

Notice: This method requires a basic understanding of programming for the web and may not work in all server environments.

Using your preferred website editor, copy & paste the following code sample in the web page where you want your form to be visible. When doing this, make sure that you are editing the HTML code directly (often called 'HTML view', or 'code view').

Your form URL is shown in the "Display & Processing" tab, under the "Show more publishing options" link. You should replace in the code sample the text INSERT_FORM_ID_HERE with the id of your form.

If your server runs PHP:

<?php if(!isset($_GET['tfa_next'])) { echo file_get_contents("http://app.formassembly.com/rest/forms/view/INSERT_FORM_ID_HERE"); } else { echo file_get_contents("http://app.formassembly.com/rest".$_GET['tfa_next']); } ?>

If your server runs ASP:

<% Dim objWinHttp Dim strHTML Set objWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1") if(request.querystring("tfa_next")="") then objWinHttp.Open "GET", "http://app.formassembly.com/rest/forms/view/INSERT_FORM_ID_HERE" else objWinHttp.Open "GET", "http://app.formassembly.com/rest" & request.querystring("tfa_next") end if objWinHttp.Send Response.Write objWinHttp.ResponseText Set objWinHttp = Nothing %>

If your run Ruby on Rails:

In your controller: def feedback if params[:tfa_next] url = "/rest/#{params[:tfa_next]}" else url = "/rest/forms/view/INSERT_FORM_ID_HERE" end response = Net::HTTP.get_response("app.formassembly.com", url).body @form_head, @form_body = response.split('<!-- FORM: BODY SECTION -->') end In your view: <% content_for("head") do %> <%= @form_head %> <% end %> <%= @form_body %> In your layout: <head> [...] <%= yield :head %> </head>

If your server uses a different server-side technology:

Regardless of what technology is available, if your server is capable of doing HTTP requests, you should be able to retrieve and display the form. Please refer to your server documentation or google for more information.

We'd love to expand this section. If you have a working method not documented here, please email it to us at support@formassembly.com. Thank you!