Jump to content
  • 0

Automatically submit a submission datapage but only run once


CoffeeLover

Question

Hi All,

I am currently using the below code to automatically submit a submission form datapage.

<script type="text/javascript"> setTimeout('document.getElementById("caspioform").submit()',1);</script>

The data is a phone number received via a parameter and it needs to be unique.

This code works fine if the field is unique but if the field is not unique it keeps trying to automatically submit the form over and over. 

How can I run auto submit but only once?

Kind regards

CoffeeLover

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @CoffeeLover,

 

You can use the following code to check if there is an error prior to submit, and submit only if there are no errors:

<script type="text/javascript"> 

const error = document.querySelector('div[data-cb-name="HeaderErrorMsg"]');
if(!error){
    setTimeout('document.getElementById("caspioform").submit()',1);
}

</script>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...