Form Field Sequencing


#1

I’m doing a landingpage for a hotel, were people can send a booking request.
In the form they can pick the date when they arrive, the date when they leave, and their personal information.

To limit faulty data, I want that the Formfield “Date_leaving” can only be filled out if they have previously filled out the form “Date_arrive”. So some kind of sequencing the form fields. Can someone help?
Thanks!


#2

Hey Markus,

This might be a dumb question, but couldn’t you just make the date arrive/leaving fields required? Then the user would have to pay attention and fill them out properly.

Otherwise there are other scripts you could add to your page if you feel comfortable doing that. A really simple one below would just hide your date_leaving field until something is typed in the Date_arrive field.

< script >
(document).ready(function () { toggleFields(); ("#Date_arrive").change(function () {
toggleFields();
});
});
function toggleFields() {
if (("#Date_arrive").val()) ("#Date_leaving").show();
else
$("#Date_leaving").hide();
};
< /script >

You could also use a more complex script but a beautiful form with multi-step…