How to manage time-related display...

User 401876 Photo


Registered User
5 posts

I wrote a formular for our theatre, where people can reserve tickets for several different plays on many different days on some different stages. I would like to add a funktion that you only can reserve tickets until one day before the event starts. So, for example, if someone would like to see someting on next Sunday, he won´t be able to reserve a ticket after Saturday.
Instead of the "submit"-button there should be a message that it is not possible to make a reservation for this particulary event. Unfortunately you can´t hide the submit-button at this stage.
I know, form builder has a "date"-Funktion, but I don´t know how this could help me solving my problem. Maybe you have an idea or write it down for further updates.

Kind regards
Rainer
User 187934 Photo


Senior Advisor
20,271 posts

I've messed around with datepicker a little bit in a custom script for a site. Here's an example where I'm blocking past dates and only allowing Sunday, Monday, Wednesday and Saturday.:cool:
http://ericrohloff.com/coffeecup/ccforu … ickerdays/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 362156 Photo


Registered User
47 posts

Eric, this is very useful! :D Just as Rainer I'm working on a website with different products that are available only on certain days of the week. In our case it concerns bike tours through the city of Rome with a preset schedule per tour. We request our clients to book at least two days in advance.
Each tour has it's own product page. To make your script even more perfect I would like the datepicker to be visible on each product page so that our clients only need to click on the selected date. From there they would then be forwarded to the form with the date field already filled. I haven't tried this out yet, but I will in the next few days.
User 187934 Photo


Senior Advisor
20,271 posts

If your looking for that then i would use a simple form with your own custom datepicker library included.
Head of page with tour product
<link rel="stylesheet" href="jquery/pepper-grinder/jquery-ui.css" />
<script src="jquery/jquery-1.9.1.js"></script>
<script src="jquery/jquery-ui.js"></script>
<script>
$(function() {
$('#datepicker').datepicker({ dateFormat: 'yy-mm-dd' }).val();

});
</script>

Body of page with tour product
<form action="reservation.html" method="POST">
<input type="text" name="resvdate" id="datepicker" value="Select your tour date" />

<input id="submit" type="submit" name="" value="Submit" />
</form>


Now on the page with your form builder form you'll want to use the $_POST['resvdate'] to populate the forms input value.

<input type="text" name="date" class="datepicker" id="item34_date_1" value="<?php if(isset($_POST["resvdate"])) { echo $_POST["resvdate"]; } ?>">


I have a way doing this through $_SESSION also.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 362156 Photo


Registered User
47 posts

Thanks, I will experiment with this during the weekend.
User 362156 Photo


Registered User
47 posts

Hi Eric,

I have experimented with your suggestion. I'm slowly moving forward, but not there yet.... I now have the datepicker set up on a tour product page (testpage http://www.opdefietsinrome.nl/testform/ … mTour.html , it's down at the bottom - I still have the css to work on). Selecting a date and pushing the send button ("reserveren") forwards you to the reservation form (http://www.opdefietsinrome.nl/testform/reserveren.html), but I cannot get the date field (in my case item93_date_1) populated. I have added "resvdate"

Form:
<div class="fb-input-date">
<input name="Datum-Pref_date" class="datepicker" id="item93_date_1" required type="text" data-hint="" value="?php if(isset($_POST["resvdate"])) { echo $_POST["resvdate"]; } ?" />

Product page:
<form action="reserveren.html" method="POST">
<input type="text" name="resvdate" class="datepicker" value="Kies een datum" />
<input id="submit" type="submit" name="" value="Reserveren" />

Scripts
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.3.custom.js"></script>
<script type="text/javascript" src="js/ui.datepicker-nl.js"></script>
</form>

Do you have any suggestions?

User 187934 Photo


Senior Advisor
20,271 posts

I would first try removing the <script> code from the form iframe code that the formbuilder populates.
So your code for embedding the form on your page will look like this.
<iframe width="100%" height="1887" style="border:none; background:transparent; overflow:hidden;"
id="fb_iframe" src="reservering_fietsen/reservering_fietsen.html">

Are you using the formbuilders own myformname.php? Or did you make your own?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 362156 Photo


Registered User
47 posts

I removed the script tags + code, but unfortunately that didn't work. I also corrected a typo in the input value to

<input name="Datum-Pref_date" class="datepicker" id="item93_date_1" required type="text" data-hint="" value="<?php if(isset($_POST["resvdate"])) { echo $_POST["resvdate"]; } ?> "/> , but now the browser assumes the tag is closed after the first > so "/> shows up below the formfield.

What am I missing here?
User 187934 Photo


Senior Advisor
20,271 posts

If you replace the myformname.php with your own you would be able to capture the post variable. The form builder relies on $_SESSION variables. Let me look at my setup where I used those instead.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 362156 Photo


Registered User
47 posts

Hi Eric,

Did you get a change to look into your setup? I have been testing the link between the datepicker and the form field on myformname.html by using altField, but I haven't yet found a way to link altField to another page.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.