"Your form has been submitted successfully"

When I submit a form, I receive the standard notice that it has submitted successfully but I have to scroll to the top of the page to see this. Once I click submit, it stays at that point on the page and the user must scroll up to see that they were successful.
Is there a way to jump to the top of the page on submission or even to display the notice in a popup?
Many thanks…

Hi!

  1. You can add a standard alert window by using this code:

     fd.spSaved(function(result) {
         alert('Your text');
     });
    
  2. To scroll up to the top of the page:

     var waitForEl = function(selector, callback) {
       if ($(selector).length) {
         callback();
       } else {
         setTimeout(function() {
           waitForEl(selector, callback);
         }, 200);
       }
     };
    
     fd.spSaved(function(result) {
         waitForEl('.alert-heading', function(e) {
            $('.alert-heading')[0].scrollIntoView({ behavior: 'smooth' })        
         });        
     });
1 Like

Hi,
I’ve added your code to the JavaScript editor but unfortunately it still does not work. The user still must scroll to the top of the page to see the alert. This is also the case if there is a warning for a mandatory field input - I still need to scroll to the top of the page to see the alert.
Any advice is greatly appreciated.

Hi!

Please try to increase a time in setTimeout(), like setTimeout(…, 1000) or even more (3000 will be enough). If it doesn’t help, provide please the screenshot of the console browser (F12) after saving the form.

Hi,
Changed the timeout to 3000 but its still doing the same error as follows:

Hi!

Could I clarify whether you use Plumsail Forms or Forms Designer?

Plumsail Forms 1.2.2

Hi!

Please try to replace ‘spSaved’ with ‘saved’ event handler. Also, you can try to decrease a timeout to 200 after that.

1 Like

Hi,
Thanks for your help. This is now working!

I’ve been trying to use the code and comments from this thread to achieve the same result but to no avail. Where should I be putting the code and what modifications would be suggested for it work?

Well never mind. I figured it out! Sorry for the false alarm. I thought this went in the “OnClick” but it goes in the form’s main JS. Works perfectly. This product and these forums are a lifesaver.

Dear Robert,

I’m glad you solve this :blush:

Hi there,
get the error message with fs.spSaved
Uncaught TypeError: fd.spSaved is not a function
at HTMLDocument. (fd_Element_Edit.aspx:967)
at j (plumsail.fd.jquery.js:2)
at Object.fireWith [as resolveWith] (plumsail.fd.jquery.js:2)
at Function.ready (plumsail.fd.jquery.js:2)
at HTMLDocument.J (plumsail.fd.jquery.js:2)

The solution with fp.save doenst show anything after the page is submitted
I have Forms Designer Client 3.1.4

Dear @mvahsen,

Forms Designer has a different API, you can examine it in these docs: https://spform.com/documentation

If you have any questions - just let us know.

P.S. In the future, it would be better to ask Forms Designer questions on the original forum, this forum is dedicated to Plumsail Forms, our newer product. But we are always glad to help!