Heads Up: This is the documentation for Joomla 3

We recommend using the Documentation for Joomla 4!

It is more up-to-date and extensive. Most of it applies retrospectively to Joomla 3.

Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Using Url Parameter to set default Values in Forms

Using Url parameters to set default values in fields is an interesting feature, because it allows you to set individual default values dynamically during run time.

As Url parameters are easy to access, this is a feature which might on the other hand invite bad users to try to manipulate your forms. Therefore we try to counter abuse with special security measures.

Allow the use of Url parameters for fields

As default the use of Url parameters is disabled. This is a security measure. You can enable the use of Url parameters individually for each field in the field configuration, tab "Advanced".

Url parameter format

You can add as many Url parameters to an Url as you need. Each parameter consists of a parametername=parametervalue pair. The first parameter which is attached to an Url has to be preceded with a question mark (?). The folloging parmetername/parametervalue pairs are attached with an ampersand (&).

As parametername you have to use the field "name", which you entered in the field configuration which is prefixed with an additional context (string, which differs, depending on how the form is published). If you publish the form via a menu item, the context is "formN", where N is the id of the form. If you have for example a field named "field1" in the form with id 1 the proper parametername of the Url parameter is form1field1. If the form is published via a module the context, which you have to use is "modvisformN". You have to replace N here with the module id!

The parametervalue is a string. You can only use strings as parametervalue, which is also a security feature.

For input fields (text, date etc.) the parametervalue can be an arbitrary string, which you want to be used as default value. If you are dealing with a select, a radio, a checkbox group or a checkbox, which comes with their specific option lists, you have to use a valid option value from the field configuration as parametervalue.

Exceptions for selects and checkbox groups

You have to add [] to the parametername when you are setting Url parameters for selects or checkbox groups. Also it is possible to set more than one default option for those field types by adding multiple Url parameters.

As an example. If you have a select with the name "select" and the three options s1||auswahl1, s2||auswahl2, s3||auswahl3 in your form with the id 2, which is published by a menu item of type Visforms and you want the first and second option to be preselected, you would add the following string to the Url: &form2select[]=s1&orm2select[]=s2 respectively ?orm2select[]=s1&orm2select[]=s2, if it's the first parameters attached to the URL.

Which value is used as default in the form?

If a form is displayed for the first time Visforms checks, if there is a default value set in the field configuration and attaches that value to the field. After that Visforms checks if Url parameters are enabled for the field and if yes, whether there is an Url parameter set for this field. If so, this value will be used as default.

If a form has already be submitted but is displayed again (for example because the php validation failed), the user inputs are used as default values.

Where do I get the Url from?

You have to create links with Url parameters manually. It is not possible to create a menu item link to a form and attach Url parameters in the menu item configuration. But you can use the forms Url as a base Url to wich you add your Url parameters.

Use Case Example

You manage events. You have a page (article) for each event, with event inforamtion and a link to a registration form. You want to use only one single registration form regardless of the event. To make registration as comfortable as possible you want event specific fields in the form, like event date and event name, to be set properly by default. Using Url parameters is an easy way to achieve this.

In addition to all the other form fields, you have to create the event specific fields in the form (a date field for event date, a select for the event names with one option for each event). Enable the use of Url params for the date field and the select. Create a menu item of type Visforms that links to the form and use the Url of that menu item as base for the link to the registration form which you provide in your event article (and which you have to enter manually). For each event article add date and the select as Url parameters with the event specific information as values. When a user clicks on the link the form will open with the event date and event name option preselected properly.

Article list