Anyway to automatically "turn off" a form after a certain time? | Community
Skip to main content
October 2, 2014
Solved

Anyway to automatically "turn off" a form after a certain time?

I work with webinar campagins; currently, I email our house list and have a "Register here" link that directs people to fill out a form to register for webinars.

Problem: Since the registeration link is in the email, people are able to access the link (and fill out the form) even after the webinar is over. Right now, I have people registering after the webinar is over, even though the registration page clearly states when the webinar started. 

Question: Is there a way to automatically "turn off" a form after a certain time so I can prevent these people from registering or redirect them? Right now, I go in after the webinar is over and just delete the form manually. 

Any help would be appreciated, even if it's a "this cannot be done." 
 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Kenny_Elkington
Kenny_ElkingtonAccepted solution
Level 10
October 2, 2014
Hey Mengchao,

You can do this with a little piece of Javascript.  It will hide the form if today's date is after your designated closed date, and display alternative content:

<script>
MktoForms2.whenReady( function(form) {
var today = new Date(); //set the current date
var registrationClose = new Date("1970/01/01"); //change to your desired date
if (today > registrationClose) {
$(".mktoForm").wrap( "<div class='formHolder'></div>" );
$(".mktoForm").hide();
$(".formHolder").append('<div><p>Sorry! Registration for this event is now closed.</p></div>'); //change to your desired content here, set appropriate classes/IDs for styling
};
});
</script>

13 replies

Iryna_Zhuravel4
Level 6
November 20, 2015

This is awesome! I wonderif something like this can be done to cap the number of registrations for an event?

Translate
October 16, 2014
Kenny,

This worked like a charm, thanks so much for the insight!
Translate
Kenny_Elkington
Level 10
October 3, 2014
Yes you can do a more specific comparison, you would just do this instead:

<script>
MktoForms2.whenReady( function(form) {
var today = new Date(); //set the current date
var registrationClose = new Date("01 January 1970 00:00:00 GMT"); //change to your desired date
if (today.getTime() > registrationClose.getTime()) {
$(".mktoForm").wrap( "<div class='formHolder'></div>" );
$(".mktoForm").hide();
$(".formHolder").append('<div><p>Sorry! Registration for this event is now closed.</p></div>'); //change to your desired content here, set appropriate classes/IDs for styling
};
});
</script>

getTime gets the exact time instead of just the date and it will perform that comparison instead.

Translate
Nicholas_Manojl
Level 8
November 5, 2015

This is pretty cool.

I wonder..could the registrationClose reference a {{date.token}}?

Translate
SanfordWhiteman
Level 10
November 5, 2015

Sure.  That's the way it's done in other posts on this topic.  Just remember that '2015-11-10'  == November 10 at 00:00:00 GMT == November 9 at 7:00pm Eastern.

Translate
October 3, 2014
Thanks for all of your replies--I've never used discussions before, but I'm convinced I'll be using it more frequently now!

@Kenny - is it possible for code to be based on the hour (for specificity) instead of the close date?
Translate
October 3, 2014
Another suggestion which is somewhat manual is to create a re-direct rule on the landing page that includes the registration form.  What's nice about this, is if you have a new webinar you want to promote, you can redirect there.
Translate
Kenny_Elkington
Level 10
October 2, 2014
I Should note that Sydney's comment is not a viable solution.  The Date of Activity filter in the Fills out Form trigger only works for past date ranges in conjunction with the Minimum Number of Times constraint.  Forward-looking operators will not function that way.
Translate
Kenny_Elkington
Kenny_ElkingtonAccepted solution
Level 10
October 2, 2014
Hey Mengchao,

You can do this with a little piece of Javascript.  It will hide the form if today's date is after your designated closed date, and display alternative content:

<script>
MktoForms2.whenReady( function(form) {
var today = new Date(); //set the current date
var registrationClose = new Date("1970/01/01"); //change to your desired date
if (today > registrationClose) {
$(".mktoForm").wrap( "<div class='formHolder'></div>" );
$(".mktoForm").hide();
$(".formHolder").append('<div><p>Sorry! Registration for this event is now closed.</p></div>'); //change to your desired content here, set appropriate classes/IDs for styling
};
});
</script>
Translate
Level 1
April 24, 2024

Hi Kenny, 

Thanks for your advice. May I ask where to put the script you shared? In the form itself or the landing page hosting the form? Can you give more detailed instruction on this? 

Many thanks 

Translate
Jo_Pitts1
Community Manager
April 24, 2024

@oliviatran ,

on the page hosting the form.

Cheers

Jo

Translate
October 2, 2014
Hi,

It doesn't seem like you can turn off the form but you can create an alternative campaign.

Smartlist:
Batch filter 1:
Fill out Form after DATE

Flow options:
-remove lead from list 
-send autoresponder (telling lead that the webinar is over)
-change data value
-remove from flow
-etc.
Translate
October 2, 2014
Hi,

It doesn't seem like you can turn off the form but you can create an alternative campaign.

Smartlist:
Batch filter 1:
Fill out Form after DATE

Flow options:
-remove lead from list 
-send autoresponder (telling lead that the webinar is over)
-change data value
-remove from flow
-etc.
Translate