Sorry for the late response. Our team is cut in half due to Covid-19 infections, so our response times are longer than usual. Thank you for your patience!
I can't say if this will be useful for you, but please take a look:
You can add the following script to the page:
<script>
var getUrlParams = function (url) {
var params = {};
var parser = document.createElement('a');
parser.href = url;
var query = parser.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
params[pair[0]] = decodeURIComponent(pair[1]);
}
return params;
};
window.urlParams = getUrlParams(window.location.href);
window.beforeConfirmBookingLoaded = function () {
var firstName = document.querySelector("#am-confirm-booking > div:nth-child(1) > form > div.am-confirm-booking-data.el-row > div:nth-child(3) > div > div > div > input");
var lastName = document.querySelector("#am-confirm-booking > div:nth-child(1) > form > div.am-confirm-booking-data.el-row > div:nth-child(4) > div > div > div > input");
if ('firstName' in window.urlParams) {
firstName.value = window.urlParams.firstName;
firstName.dispatchEvent(new Event('input'));
}
if ('lastName' in window.urlParams) {
lastName.value = window.urlParams.lastName;
lastName.dispatchEvent(new Event('input'));
}
}
</script>
Hello,
is there a way to pre-fill the form fields from get parameters?
Thank you
Hello Luca
Sorry for the late response. Our team is cut in half due to Covid-19 infections, so our response times are longer than usual. Thank you for your patience!
I can't say if this will be useful for you, but please take a look:
You can add the following script to the page:
So, if you enter the following in the URL: https://yourwebsite.com/booking-page/?firstName=John&lastName=Doe "John Doe" will be added to the fields of the name and last name on the front-end.
Also, if you add the following to the email template: https://yourwebsite.com/booking-page/?firstName=%customer_first_name%&lastName=%customer_last_name% the name and the last name of the customer will be entered.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables