You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Submit a form without user interaction

posted on July 1, 2020

I am trying to use a form URL with the required token to submit the form automatically. 

This is the URL for my local VM...

http://win-vqshqo32af5/Forms/Testing?RequiredValue=Token

I have been trying different variations of JavaScript but have not had any luck.

This is the closest I have come to triggering the submit...

 

$(document).ready(function(){
  
  $("#form1").trigger('submit');
});

I do not want the user to click a button or any other interaction other that clicking on the URL 

Thanks in advance

Jonathan

0 0
replied on July 1, 2020
$(document).ready(function () {
	$('.Submit').click();
})

Hey John - try this snippet. Be aware that if you have lookup rules, this might try to submit the form before those lookups complete. 

1 0
replied on July 1, 2020

Hi Brian,

Unfortunately, that did not trigger the submit. :(

 

Jono

0 0
replied on July 2, 2020

Do you have required fields on the form that aren't filled out? Is the form a standard submission or is it an approve/deny step?

0 0
replied on July 2, 2020

try this

$(document).ready(function(){
  var clickEvent = new MouseEvent("click", {
    "view": window,
    "bubbles": true,
    "cancelable": false
  });
  $('.Submit').dispatchEvent(clickEvent);
});

 

0 0
replied on July 2, 2020

Hi All,

A friend of mine came up with this (below), in addition to what Brian Rook suggested.

$(document).ready(function () {
  setTimeout(function() {
    $('.Submit').click();
  }, 1000);
});

This works.

 

Thanks all for your help

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.