Jump to content

Confirm form submission if a certain condition is met

Recommended Posts

Hello Caspio Family,

I wish to share a JS code snippet with you, in case if you wish your users to confirm form submission if a certain condition is met. For example, if some field is empty.

Let's say we have a text field for email which is not required. When that field is empty, we wish to ask our visitors if they are sure they want to submit the for without the email.

document.addEventListener("BeforeFormSubmit", function (event) {
  if (document.getElementById("InsertRecordEmail").value == "") {
    if (confirm("Are you sure you want to submit the form without your email?")) {

Let me know who thinks it is useful.

Link to comment
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.

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.

  • Create New...