Select records
Note: These features are part of the Visforms Subscription and are not included in the free Visforms version.
For a better understanding, we recommend reading the documentation completely and using the
Section Introduction
to start.
Relationships explained in earlier sections of the documentation are not repeated here.
The plugin allows you to select specific datasets for display. This is done using the values that the user submitted for any form field.
You need fields in the form that contain unique values. You can then use these unique values for data selection.
These include:
- List boxes
- Radio Buttons or checkboxes
- Fields with default values set using the Content Plugin - Visforms Form View.
The specific data record selection is made solely with the help of the plugin parameter fieldselect.
Unlike all other plugin parameters, the fieldselect parameter itself expects a list of name-value pairs. Listing of name-value pairs must also conform to plugin string syntax rules. More in: Form data in article.
Use the ID of the field whose values are selected as the name. As a value, you can either specify a unique field value, such as green or 3. Or you can use selected variables, such as the URL of the current page or the username of the logged-in user.
For example, the following fieldselect parameter does the following. Only records are displayed that have the number 1 in the field with the ID 1 and the value green in the field with the ID 5
"fieldselect":{"1":"1","5":"green"}
Note: Please note that the data display in the frontend must always be allowed for fields that are used for data selection. This is the case even if you don't display the field itself in the data view, but only use it as a control field for data selection in the fieldselect parameter. The field is therefore not contained in the fieldlist parameter itself.
Embed fieldselect parameter in plugin string
{vfdataview}{"formid":"6","fieldselect":{"1":"1","5":"green"},"fieldlist":"1,2,3,5","layout ":"list"}{/vfdataview}
Use of variables for data set selection
In addition to concrete values, you can also use a number of variables in the data set selection. The following parameter <span class=code">fieldselect ensures that only data records are displayed that have the URL of the current page in the field with ID 1.
"fieldselect”:{“1”:"[_url]"}
The plugin supports the following variables:
- [_url]: URL of the current page.
- [_name]: Name of the logged-in user.
- [_username]: Username of the logged-in user.
- [_email]: Email of the registered user.
With the Content Plugin - Visforms Form View you can fill a form field with the URL of the current page. This also applies to hidden form fields.
You can use the default value settings of the “Text” and “E-Mail” type fields to create fields that are filled with information about the logged-in user by default. Information includes:
- the username and
- the email of the registered user.
With the “Readonly” option, you also lock these fields against changes. This means that the corresponding values are available to the plugin for data record selection.