Passing of url parameters to form fields help both the user who avoids filling out already known fields and the site owner who controls maintains the data quality of form submissions.
For example, field values can be passed to a form using the following structure:
FORM-URL/?subscription_type=TAX-VALUE&emd_subscribe_email=EMAIL
In the above example, we pass subscription_type and emd_subscribe_email parameters. FORM-URL is the url where your WPAS form resides. EMAIL is a dynamic value which changes based on the user. TAX-VALUE is a static value which you set.
Currently, you can only pass values to text and dropdown types. Since WPAS displays taxonomies and relationships as dropdowns, these can be used as well. In the above example, we are passing subscription type taxonomy a static value.
This feature has been added to WP App Studio 4.9 and can be implemented in two ways:
- explicit passing
- hidden passing
Explicit Passing
Explicit passing method is used when you want users to see the passed value(s). For example, you may want users to see the email address field in an email subscription form. This helps confirmation of the passed value and the intended action by the user.
For example, if you put the following URL structure, in an email link, WPAS will fill out the fields for you.
FORM-URL?subscription_type=subscribe-to-all&[email protected]
It is important that:
- You use the correct attribute, taxonomy or relationship name here
- You have the form field where you want its value to be put the form layout. You can find the name to be used in your WPAS design corresponding the fields to be used.
Implicit Passing
Implicit passing is used when you do not need users to see the passed value(s). For example, you direct the user to a survey form from an email where the email address uniquely identifies the user. You can pass the email field as a hidden function in your WPAS design.
It is important that:
- You create the field to be passed as an attribute of hidden function type. "Parameter passing" function must be used to make this method work.
- The field created must be added to the form layout
Wrapping Up
Passing values to WPAS forms is an efficient way of controlling and maintaining your site's data quality. It also helps users to avoid repetitive tasks and hopefully encourage them to fill out your form. it is a dynamic alternative to setting default values to your fields.
Look forward to your questions or comments.