Hi all, is there a way to close a typeform during certain times?
I want to tell people on a time sensitive survey that they can’t fill out a survey if they are taking it out of hours?
Thanks!
Hi all, is there a way to close a typeform during certain times?
I want to tell people on a time sensitive survey that they can’t fill out a survey if they are taking it out of hours?
Thanks!
Best answer by jeremielp
I think @curiousinengland refers to having the form only active during opening hours not when a business is close. The link you mentioned only allows to close it, but won’t reopen the next day.
There is no native option to do that, but you can embed the Typeform in Javascript, only if the page is loaded while the current time being in the active hours.
Something like this:
<div id="tf"></div>
<link rel="stylesheet" href="//embed.typeform.com/next/css/widget.css" />
<script src="//embed.typeform.com/next/embed.js"></script>
<script>
function isBusinessHours() {
var now = new Date();
var hour = now.getHours();
return hour >= 9 && hour < 18; // 9 AM to 6 PM
}
if (isBusinessHours()) {
window.tf.createWidget('<form-id>', {
container: document.getElementById('tf'),
hidden: { url_form: window.location.href }
});
}
</script>
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.