Prefill the form field though url parameters (#1021).

This commit is contained in:
Alex Tselegidis 2022-01-24 23:57:59 +01:00
parent 9097a968ca
commit 72baa18b86

View file

@ -220,9 +220,27 @@ App.Pages.Booking = (function () {
.text(index + 1)
);
}
prefillFromQueryParam('#first-name', 'first_name');
prefillFromQueryParam('#last-name', 'last_name');
prefillFromQueryParam('#email', 'email');
prefillFromQueryParam('#phone-number', 'phone');
prefillFromQueryParam('#address', 'address');
prefillFromQueryParam('#city', 'city');
prefillFromQueryParam('#zip-code', 'zip');
}
}
function prefillFromQueryParam(field, param) {
const $target = $(field);
if (!$target.length) {
return;
}
$target.val(App.Utils.Url.queryParam(param));
}
/**
* Remove empty columns and center elements if needed.
*/