Date and time in Web Form Builder -...

User 2982483 Photo


Registered User
43 posts

No worries at all and I appreciate your time on this.
User 187934 Photo


Senior Advisor
20,181 posts

Ok time to work out final details.
Appointment form.
https://ericrohloff.com/coffeecup/ccfor … me-picker/

Blocking form
https://ericrohloff.com/coffeecup/ccfor … /index.php

I had to build my Blocking form within Site Designer because Form Builder has a bug dealing with a checkbox.
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 2982483 Photo


Registered User
43 posts

OK Eric, this is just the job. Working perfectly. What's the next step as far as integrating the forms?
I don't actually use Site Designer I use (said whispering) Bootstrap Studio.

User 187934 Photo


Senior Advisor
20,181 posts

Lets start with your Form Builder form.
The input you put on there for the date should be a text input. Don't use the actual datepicker input.
Put this code at the top of your form page above the <!DOCTYPE HTML>
My date in put has the name of date.
My Time select has the name of time.
<?php
include('../scripts/includes/pdo_connect.php');
//*** Edit these to fit your needs ***//
$dbtableblock = 'name of your appointment table';
//*** End of edit ***//


$sql = $pdo->prepare("SELECT date(date) a FROM $dbtableblock WHERE time ='' ORDER BY date DESC");
$sql->execute();
$results = $sql;
$results = array();;
$sql->bindColumn('a',$a);
while($row = $sql->fetch()) {
$results = array_merge($results, explode(',', date('Y-n-j',strtotime($a))));

}

?>

Put this code between the </title> and </head> tag of your forms page.
<script src="../scripts/jquery-ui-1.13.1.custom/jquery.min.js"></script>

<script src="../scripts/jquery-ui-1.13.1.custom/jquery-ui.js"></script>

<script>
var jQ = $.noConflict();
jQ(function() {

//***Datepicker
var UnavailableDates = ["<?php echo implode('","', $results);?>"];

function Unavailable(date) {
dmy1 =date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate() ;
if (jQ.inArray(dmy1, UnavailableDates) >=0 || !jQ.datepicker.noWeekends(date)[0]) {
return [false,"", "Appointments Unavailable"];
} else {
return [true, "", "Appointments Available"];
}
}


jQ("input[name='date']").datepicker({

dateFormat: "yy-mm-dd",
changeMonth: true,
changeYear: false,
minDate: 0,
beforeShowDay: Unavailable,
dateFormat: 'yy-mm-dd',
onSelect: function(date,i) {
if(date !== i.lastVal){
jQ('select[name="time"]').load("../scripts/includes/time-drop-down.php?date=" + jQ('input[name="date"]').val());
}
}

});
jQ('select[name="time"]').change(function() {
if(jQ(this).val()== ''){
jQ(':input[type="submit"]').prop('disabled', true);
}else{jQ(':input[type="submit"]').prop('disabled', false);}
});

jQ("form").submit(function () {
if(jQ('select[name="time"]').val()== ''){
jQ(':input[type="submit"]').prop('disabled', true);
}else{jQ(':input[type="submit"]').prop('disabled', false);}
});

});
</script>

For the time add a dropdown with one option. Like Choose Date First .
Make this required.
You'll also need to change your form to a .php file for this to work.
Download the scripts.zip and add them to your site. Depending on your directory setup they should be at the same level of your Form Builders exported files.
To build a blocking database table you can copy your Appointment table and manually alter the table on your Phpadmin within your Host login.
Within the scripts you need to enter your database, table and user info.
Those would be the scripts inside the includes directory.
pdo_connet.php
time-drop-down.php

Also at the top of the script above I have it commented where you can edit.
Lets get this running first then address the Blocking form.
Attachments:
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 2982483 Photo


Registered User
43 posts

OK everything works brilliantly in terms of your coding. I just need to tweak a couple of things within the form.
But, I had added some payment options and now when hitting 'submit' post changes it no longer goes to the paypal payment page it's just blank, but a transaction id is registered within the db?
User 187934 Photo


Senior Advisor
20,181 posts

What a url is the blank page showing in your browser?
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 2982483 Photo


Registered User
43 posts

It resolves one folder back with 'Booking Form.php'.
User 187934 Photo


Senior Advisor
20,181 posts

Are you using an iframe to show your form or going directly to the form page?
Give this a try.
Line 62 of the formpage.cls.php page
It's in the directory myformname/fbapp/php/formpage.cls.php
Change this
$filename = $this->name . '.html';

to
$filename = $this->name . '.php';

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 2982483 Photo


Registered User
43 posts

OK so changed that and go this at the top after submission:
"Dispatch(); } else { if( ! isset( $_GET['action'] ) ) $myPage->ReportStats( 'NotifyFormView' ); } ob_start(); $myPage->Show(); ob_end_flush(); ?>

Your form could not be submitted for the following reason(s):
"Time" doesn't have a valid value."

Not using iframe.
User 187934 Photo


Senior Advisor
20,181 posts

On the form.cfg.php
remove this from the time validation script.
,"values":[""]
"time":{"label":"Select an available Time","fieldtype":"dropdown","required":true,"values":[""]

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

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.