Copy forms and data to another website
Note: These features are part of the Visforms Subscription and are not included in the free Visforms version.
With the Visforms Subscription it is possible to export and import form definitions.
You can export forms that were created on one website.
You can then import the exported forms onto another website.
This copying of forms between websites is particularly interesting if you develop forms on a test system and want to transfer them to a productive system after testing.
Or you have similar websites with similar forms and you want to exchange the form definitions between these websites.
The way Joomla works makes it quite difficult to copy forms between websites.
Unfortunately in Joomla there is a tight link between
- the Joomla Core Data and
- the data of Joomla extensions, such as that of Visforms.
First and foremost there are the Joomla users. Each component that stores data in the database associates the currently logged-in user with the component data. The form definitions of Visforms are also affected.
In second place are there
- the user groups,
- the access levels and
- the access rights assigned to the user groups.
This information is stored in the Joomla Core tables. Normally this data is different on each website. Even if the same user groups exist, they often have different IDs. And ultimately it is always the IDs that establish the technical connection between the tables.
Visforms tries to handle these issues as intelligently as possible.
Still, the only person who knows is you
- whether forms are copied between 2 identical clones of the same website (development site and production site) or
- whether forms are transferred to a completely different system (similar websites).
That’s why Visforms offers you a number of options for the export.
You must adapt these export options to your specific requirements.
You can decide which parts of the form definition you want to export:
- Fields,
- saved transmissions,
- PDF templates.
You must also decide whether to preserve user IDs and ACL settings.
The export
Select forms for export
Go to the “Forms” view in the Visforms administration. There you will see the list of all forms. Now use the checkbox in the table to select which forms you want to export. The checkbox appears in front of each form entry.
Then click on the “Export form definition” button in the button bar. A modal window opens in which you can make settings for the export. Then click the “Export form definition” button at the bottom of the modal window to start the export.
JSON file in the web browser download folder
The exported form definitions are now saved in a JSON file on your computer. This is a normal download via the web browser. The storage location therefore depends on the browser settings for the download folder.
Export settings
Note: The export presets are optimized for when you copy forms between different websites.
Only activate the options for exporting user IDs and ACL settings if you want to copy forms between identical websites.
The import
In the Visforms administration in the forms view click on the button “Import form definition”. A modal window will open where you select the file to use for the import.
Note: Forms are always imported as new forms and never overwrite existing forms.
All form definition data (forms, fields, PDF templates) that are created in the database as a result of the import are created as data for the currently logged-in user.
Unless you have activated the option “Preserve user IDs on export” during the export.
Saved form data is created without assignment to a registered Joomla user.
Unless you have activated the option “Preserve user IDs on export” during the export.
The form IDs and field IDs in the database on the import system are most likely different than on the export system. Visforms tries to correct all form ID and field ID dependencies during import.
In particular, this concerns:
- SQL statements in PDF templates,
- all ‘selectsql’, ‘radiosql’ and ‘multicheckboxsql’ fields,
- conditional display of fields,
- Calculations and the like.
Note: When there are such dependencies between your forms, it is absolutely essential that you always export all forms at once.
Otherwise, Visforms has no possibility to find and correct the existing dependencies during the import.
Please note that Visforms does not check whether the versions on the export system and the import system match. We therefore recommend copying forms only between systems with identical or at least sufficiently similar Visforms and Visforms Subscription versions. Otherwise, it is possible that the forms on the import system will not work correctly.
Individual PHP code tags
Field and form configuration may contain PHP code
In principle, it is possible to enter PHP code at various points in the configuration of fields and forms. For example in the form configuration on the ‘Data display in the frontend’ tab, in the bottom parameter ‘Frontend description’ using the text editor. This allows the display of the form or the form data to be expanded with user-defined functions and additional individual information.
Joomla prevents reading insecure files for security reasons
For various security reasons, Joomla prevents the reading of insecure texts from files. This also includes PHP code tags. The behavior of Joomla cannot be influenced at this point, not even via the ‘Global Configuration’ or other places. The JSON files exported with Visforms are also affected during the subsequent import to Visforms.
Note: However, it is still possible to carry out an error-free export and import using a small manual detour.
Rename PHP code tags
To do this, temporarily rename the PHP code tags in the affected areas before exporting, for example from <?php to <___?php. Forms can then be exported without errors and then imported.
You can then undo the temporary text replacements of the PHP code tags in the form configuration.