Easy Registration Forms allows to dynamically populate a Form field from a query string. One of the common use is to identify the source of submission. It can be easily achieved by just appending a parameter in the URL. This article will show you how to use query strings to prefill a form field.
What is a Query String?
Query string allows appending any information with a given URL. For example:
http://example.com/form-url/?name=john
Here we are passing name parameter with a value john
It is a common approach to pass any information with the URL. Information can be used in the database or to provide any instruction to the server.
How to use
Our plugin comes with an in-built feature to dynamically populate a form field from the query string. The best part is that there is no additional step to set up this feature. You just have to append parameter within the URL and it automatically populates the related fields. Make sure that your parameter name and field’s label is identical. For example:
https://www.easyregistrationforms.com/support/?message=My name is john
In the above URL, we are passing a default message value in our support form’s Message field.
You can even pass multiple parameters within the same URL by concatenating them with &:
Here we are passing the Website URL along with Message field.
*Note: If any of your field’s label contains space, replace it with an underscore while passing them in URL.
You can also populate dropdown or radio type field values:
Here we passed Query Type as Support Request
Multiple values for a single field (Multi-Select and Checkbox ) can be passed by appending |
https://xyz.com/register/?checkbox_group=option-1|option-2&multi_select=option-1|option-2
That’s it! Feel free to contact us if we have any questions or suggestions.