You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/views/mobile_first/gh-tour-form.php

69 lines
3.2 KiB
PHTML

<div class="form_content">
<div class="formtitle">
<h2>Why Travel with Global Highlights</h2>
<ul>
<li class="tailormade"><strong>Tailor-made experience:</strong> All of your ideas/needs will be carefully
considered to create your ideal trip.</li>
<li class="worryfree"><strong>Worry-free planning: </strong>Every step of your trip, you will be looked
after by your 1:1 travel consultant based in Asia.</li>
<li class="norisk"><strong>No-risk booking:</strong> We refund as much as we can and adapt flexibly to
unexpected changes.</li>
</ul>
</div>
<div class="ghwhyus">
<form action="/form/save" method="post">
<div class="InquiryFormBox">
<div class="FieldSet">
<p><input class="FullName" data-required="Please enter your fullname" id="realname" name="realname"
placeholder="Full name" required="" type="text"></p>
<p><input class="EmailAddress" data-required="Please enter your e-mail address"
data-pattern="Expecting an e-mail address" id="email" name="email" pattern="^[\w\-\.]+@[\w\-\.]+(\.\w+)+$"
placeholder="Email" required type="text"></p>
<p><input class="InquiryCalendar" data-min-date="7" id="starting_date" name="starting_date"
placeholder="Starting date" required type="date"></p>
<p><input class="Inquiryphone" name="phone" placeholder="Phone or other ways to contact you"
type="text"> </p>
<textarea id="additionalrequirements" name="additionalrequirements"
placeholder="How many people, hotel style and changes to make... " style="margin-bottom:20px;"></textarea>
<input name="nullemail" placeholder="Your alternative email?" type="hidden">
<input id="url" name="url" type="hidden">
<input id="sourcetype" name="sourcetype" type="hidden" value="32113">
<button class="sendButton" type="submit">
Send My Inquiry
</button>
</div>
</div>
</form>
</div>
</div>
<script>
(function () {
String.prototype.lpad = function (padString, length) {
var str = this;
while (str.length < length)
str = padString + str;
return str;
}
document.getElementById("url").value = (window.location.href);
const dateOffset = document.getElementById('starting_date').dataset.minDate;
const today = new Date();
const startMinDate = new Date(today.setDate(today.getDate() + parseInt(dateOffset)));
const minDateStr =
startMinDate.getFullYear() + '-' +
(startMinDate.getMonth() + 1).toString().lpad('0', 2) + '-' +
startMinDate.getDate().toString().lpad('0', 2);
document.getElementById('starting_date').setAttribute("min", minDateStr);
const required_fields = document.querySelectorAll(":required");
required_fields.forEach(element => {
element.addEventListener("input", function(event) {
if (element.validity.valueMissing) {
element.setCustomValidity(element.dataset.required);
} else if (element.validity.patternMismatch) {
element.setCustomValidity(element.dataset.pattern);
} else {
element.setCustomValidity("");
}
});
});
})();
</script>