› Forums › Classic DFFS › on click of save – show alert while preSave is running code?
Tagged: double dialogue, preSave, saving
- This topic has 11 replies, 3 voices, and was last updated 2 years, 6 months ago by
Alexander Bautz.
-
AuthorPosts
-
-
May 6, 2020 at 20:27 #29829
Jon Whisman
ParticipantHi,
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?
-
May 6, 2020 at 22:30 #29831
Alexander Bautz
KeymasterYou 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
-
May 19, 2021 at 14:20 #33547
Steve
ParticipantHello, 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.
SteoAttachments:
-
May 19, 2021 at 15:33 #33552
Alexander Bautz
KeymasterI fixed a bug that could cause this in v4.4.5.18 on March 05, 2021: https://spjsblog.com/dffs/dffs-change-log/#DFFS_v44518
Let me know if that fixes the issue.
Alexander
-
May 20, 2021 at 07:16 #33561
Steve
ParticipantI 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
-
May 20, 2021 at 11:26 #33568
Alexander Bautz
KeymasterAre 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
-
May 20, 2021 at 11:46 #33574
Steve
ParticipantHere 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.
SteoAttachments:
-
May 20, 2021 at 11:49 #33577
Alexander Bautz
KeymasterIs this all the custom js? – how are you calling the function zadatelInfo?
Alexander
-
May 20, 2021 at 11:52 #33579
Steve
ParticipantThis rule.
If the name in the data field is changed or filled, it should trigger the function.Steo
Attachments:
-
May 20, 2021 at 12:01 #33582
Alexander Bautz
KeymasterOK, are you manually calling the dffs_PreSaveAction function from anywhere? – if so, don’t do that as it is automatically triggered when saving.
Alexander
-
-
May 20, 2021 at 12:04 #33584
Steve
ParticipantYou 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-
May 20, 2021 at 14:59 #33588
Alexander Bautz
KeymasterI’m glad you figured it out.
Alexander
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.