Dynamic form field population

Documentation Menu

Dynamic form field population

Using the dynamic population in WP Booking System, you can dynamically populate a field with a value, through a query string in the URL or by using a PHP filter.

First, you have to enable the dynamic population option for the form field you want to dynamically populate.

Also, notice the Field ID in the form field header. You will need this later.

After you enabled dynamic population, you have 2 methods of adding your value to the field:

Query String

You can populate a field via the query string by appending the wpbs-field-{$id} parameter to the end of your form URL along with your custom value.

For example:

https://www.yoursite.com/booking-page/?wpbs-field-2=Mike

This will automatically populate the field with “Mike”

Filter

To dynamically populate a field using a PHP filter, add this code to your theme’s functions.php file:

The filter is wpbs_form_field_value_{$form_id}_{$field_id}

For checkboxes or radio form fields, the value must be returned as an array.

Was this article helpful?

Yes No

We're sorry to see this article wasn't as helpful as we hoped it would be. Please let us know what you were looking for so that we can improve this documentation page.

Full CTA BG