Jump to content

Recommended Posts

Hi, See below the code which i've used on a web form submission successfully.  I've tested this on the Details page, it seems to work, however, the changes made on the Details page don't get written to the database table.

Any advise welcome..

<script>

// PREVENT SUBMIT UNLESS VALIDATED
document.addEventListener('BeforeFormSubmit', function(event) {
event.preventDefault();

//do something before submitting update

document.forms["caspioform"].submit();

});
</script>

 

Link to post
Share on other sites
  • 2 months later...

Hi @Elderberg,

I would like to share a different approach, so instead of using a submit() function I have used the click() function on Submit button to mimic submit event.

Also, it is possible to use AppKey of the Datapage in order to submit the particular Datapage if more than one is deployed.

<script type="text/javascript">
document.addEventListener('BeforeFormSubmit', function (event) {
  
if (event.detail.appKey == 'XXXXXXXXXXXX') { 
  
event.preventDefault();  
  
//do smth before Submit
  
document.querySelector(`#Submit${event.detail.uniqueSuffix}`).click();
  
}

});
</script>

Hope it helps.

Regards,

vitaliksssss

Link to post
Share on other sites
  • 4 weeks later...

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
Reply to this topic...

×   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...