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

Question

Question

Forms Alert allow user to edit form after clicking OK

asked on November 10, 2023 Show version history

I have a form with a collection and want to display an alert reminding the user to check for duplicate entries if there is more than one collection. I want the user to be able to click OK and then able to edit the form before submitting, but I can't figure out how to do the following:

1. User adds multiple collections (rows).

2. User clicks submit button.

3. Alert prompts user to confirm that they did not enter duplicate entries.

4. User clicks 'OK'.

5. Prompt window closes and user can now edit the form before clicking the Submit button again. 

6. Submit button functions as normal, submitting the form without a prompt.

I am looking for a clean solution to this, here is what I have so far. The issue is once the user clicks the 'OK' button on the alert, the form is instantly submitted. 

$(document).ready(function(){
  $('.Submit').click(function(){
    var colCount = $(".cf-collection-block .rpx").length;
    if (colCount > 1){
    	alert("Confirm you did not enter duplicate entries.");
    } else {
      return true;
    }
  });
});  

Please let me know if there are any other options or solutions to this.

0 0

Answer

SELECTED ANSWER
replied on November 27, 2023 Show version history

Sorry, I resolved the issue and Laserfiche Answers seemed to be down so I couldn't update my post. I resolved it using the "one" method.

$(document).ready(function(){
  $('.Submit').one('click', function(){
    var colCount = $(".cf-collection-block .rpx").length;
    if (colCount > 1){
        alert("Confirm you did not enter duplicate entries.");
        return false;
      }	else {
        return true;
      }
  });
});

 

0 0

Replies

replied on November 22, 2023 Show version history

you can try to use 'confirm("Confirm you did not enter duplicate entries.")' instead of 'alert()'

0 0
SELECTED ANSWER
replied on November 27, 2023 Show version history

Sorry, I resolved the issue and Laserfiche Answers seemed to be down so I couldn't update my post. I resolved it using the "one" method.

$(document).ready(function(){
  $('.Submit').one('click', function(){
    var colCount = $(".cf-collection-block .rpx").length;
    if (colCount > 1){
        alert("Confirm you did not enter duplicate entries.");
        return false;
      }	else {
        return true;
      }
  });
});

 

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

Sign in to reply to this post.