on click of save – show alert while preSave is running code?

Home Forums Classic DFFS on click of save – show alert while preSave is running code?

Viewing 4 reply threads
  • Author
    Posts
    • #29829
      Jon Whisman
      Participant

        Hi,

        I have a few functions being called in preSave – but they take sometime to run depending on our app farm environment or the form data. What i’d like to do is show an spjs.dffs.alert immediately upon the user clicking save. The alert would be like: “saving…please wait”.

        The reason for this is because users are sometimes seeing a delay of a few seconds from the time they have clicked the save button to when the form is actually saved.

        Any way to do that?

      • #29831
        Alexander Bautz
        Keymaster

          You can try it like this in your dffs_PreSaveAction function:

          function dffs_PreSaveAction() {
              spjs.dffs.alert({
                  "title": "Saving the form",
                  "msg": "Please wait while saving the form...",
                  "noBtn": true
              });
              // the rest of your code
          }

          Alexander

        • #33547
          Steve
          Participant

            Hello, it works, thank you, but the dialogue shows twice.
            I use the rule “The form is saved” calling the function you posted above.
            See the attachment.

            Thank you for a piece of advice.
            Steo

            Attachments:
          • #33561
            Steve
            Participant

              I got the newest version.
              Dynamic Forms for SharePoint v4.4.5.24 – May 5, 2021, and double dialogues still occurs.

              Also I would like to use it for newForm but I tried to save the form with some fields required were blank, I could not end the dialogue. The dialogue should appear only when the all required data fields are filled and the save button is hit.

              Thak you Alex,

              Steo

              • #33568
                Alexander Bautz
                Keymaster

                  Are you 100% sure you have the same version loaded in your “frontend”? – check the Enhanced with DFFS link below the form to see the version loaded.

                  Also, are you sending any emails in this form when it is saved? – the original dual-call-dffs_PreSaveActoin-bug was related to the email processing.

                  If it is the correct version I need to see your custom js. If you don’t have any sensitive info in it you can post it here – alternatively you can email it to me (on the address you get this notification from).

                  Using this code in NewForm will always show the message as it does not check to see if the field are filled. It is possible to do that and only show the message if you are missing input in some fields, but you should turn on the “Show list of empty required fields when attempting to save the form” feature in the Misc tab instead.

                  Alexander

                • #33574
                  Steve
                  Participant

                    Here it is, I think my frontEnd version is OK, don’t you think?
                    See the attachment. I also attach custom code in the Custom JS section in DFFS.
                    Steo

                  • #33577
                    Alexander Bautz
                    Keymaster

                      Is this all the custom js? – how are you calling the function zadatelInfo?

                      Alexander

                    • #33579
                      Steve
                      Participant

                        This rule.
                        If the name in the data field is changed or filled, it should trigger the function.

                        Steo

                      • #33582
                        Alexander Bautz
                        Keymaster

                          OK, are you manually calling the dffs_PreSaveAction function from anywhere? – if so, don’t do that as it is automatically triggered when saving.

                          Alexander

                      • #33584
                        Steve
                        Participant

                          You got it! 🙂
                          Yes, I was calling the function from a rule set to “form is saved”.
                          Thank you Alex for your time, I love DFFS more and more for its features that are necessary for some projects we build.

                          Thanks
                          Steo

                      Viewing 4 reply threads
                      • You must be logged in to reply to this topic.