Insert Web Form in Drupal

Arclab® Web Form Builder

Build the Form (php File)

First create the form in Arclab Web Form Builder and then click on "Build Web Form".


Build Web Form


Save the file and upload it (using FTP) to the root directory of the Drupal installation. If you select a subdirectory, you will need to adjust the path later.
In this example we use the filename "webform.php".

The form (php) file is now in the Drupal root folder, so the path is: /webform.php

If you save it to e.g. the subfolder /forms, the path is /forms/webform.php

Log into Drupal

Log in as a user of the role "Administrator".
Please note that restricted users might not be allowed to insert javascript code, so they can not insert the form.



Edit Drupal Page and switch the "Text Format"

First change the "Text Format" to "Full HTML".


Drupal Text Mode

(In this example the web form should be shown between both "Demo Text" paragraphs.)



Switch to "Source"

Click on "Source" to switch the editor in source (HTML) mode:


Switch to Source

(In this example the web form should be shown between both "Demo Text" paragraphs.)



Copy/Paste the Javascript Code

The form will be integrated into the Drupal page via Javascript code:


<div id="awf-form"><script>var awf_load=new XMLHttpRequest();'GET','/webform.php?js=awf');awf_load.onreadystatechange=function(){if(awf_load.readyState===4&&awf_load.status===200){var s=document.createElement('script');s.innerHTML=awf_load.responseText;document.head.appendChild(s);awf_Run('awf-form');}};awf_load.send();</script></div>

The exact code to insert your form will automatically be displayed after the form has been created.
If this option has been disabled, you can also view the code under "Web Integration".

If you have copied the Javascript code directly from the program, you must change the path from "webform.php" to "/webform.php".
This is necessary because of the Drupal page structure and the use of virtual folders.
If you have uploaded the form (php) file to a subfolder, e.g. "/forms", then you need to change it to: "/forms/webform.php".


Copy and paste the code into the Drupal (Source) editor:


Paste Code


The red text marks are caused by the spelling correction (paste) and can be ignored.


Finally "Save" the page and check if the form is shown correctly:


Save Drupal Page with Form Code


If the form is not shown correctly:

  • Are you logged in as user of the "Administrator" group?
  • Have you switched the "Text Format" to "Full HTML"?
  • Have you added the Javascript code to the "Source" section of the editor?
  • Have you uploaded the form (php) file to the correct folder?
  • Is the path (in the javascript) to the form (php) file correct?