Hi !
I’m trying to have a form that automatically submits after a certain amount of time.
My page contains a Wixform and a submit #button1 (They have been dragged and dropped from the wix elements)
So far, I have been able to code a 30 min countdown timer, and I have a “If” trigger when the countdown reaches 0…
I want to have this trigger either submit the form, or automatically press the #button1.
Here is my code:
$w . onReady ( function () {
var countDownDate = new Date (). getTime ()+( 1800000 ); // Countdown 30 min
var x = setInterval ( function () {
var now = new Date (). getTime ();
var distance = countDownDate - now ;
var hours = Math . floor (( distance % ( 1000 * 60 * 60 * 24 )) / ( 1000 * 60 * 60 ));
var minutes = Math . floor (( distance % ( 1000 * 60 * 60 )) / ( 1000 * 60 ));
var seconds = Math . floor (( distance % ( 1000 * 60 )) / 1000 );
$w ( "#text17" ). text = minutes + "m " + seconds + "s " ;
if ( distance < 0 ) {
clearInterval ( x );
//here, either submit the form or “Click #button1”
}
}, 1000 );
});
Thanks in advance!