Home › Forums › Classic DFFS › Custom Save Button
- This topic has 7 replies, 3 voices, and was last updated 5 years, 3 months ago by Alexander Bautz.
-
AuthorPosts
-
-
December 30, 2015 at 23:56 #9717
Hello,
I might be missing something simple here, but in SharePoint 2010 and DFFS 4.358, I’m trying to add a button at the bottom of the form that will save the SharePoint item, and will also run a custom function to set a couple field values. I have this code below, which I know to insert into a header, but what is the dffs or js syntax to do a save in SharePoint?
<button type=”button” onclick=”spjs.dffs.triggerRule([‘Append’]);”>Submit and Save</button>
-
January 2, 2016 at 09:30 #9735
Hi,
The best way to save the form is by clicking the save item button:$("input[id$='SaveItem']:first").trigger("click");
You could also use a rule in DFFS with trigger “The form is saved” to trigger your custom function before save.
Alexander
-
August 21, 2019 at 13:44 #26739
-
August 21, 2019 at 15:58 #26746
I’m not sure I follow – if the form is not saved the checkbox value is not saved either… – can you explain?
Alexander
-
August 21, 2019 at 16:26 #26754
no what i am saying is that if the form is not saved because of some required fields should be filled and the submit button called a function to set some fields values we should reset these fields because the form is not saved.
anyway i found a way to do that.function checkRequired() { $('.dffs-formvalidation').each(function(){ if( $(this).val() == "" ){ setFieldValue('RequesterSubmit','false'); console.log("Test PAssed") return false; } }); }
-
August 21, 2019 at 16:30 #26756
OK, you might also use the “The form is saved” trigger as it will only be run if all required fields are filled.
Alexander
-
August 21, 2019 at 16:42 #26758
yes, but this option will not help me in my case because i have 2 buttons Submit and Save as Draft, and ofcourse the submit button is triggering the main sharepoint save button so if i want to update the request submitted field i have to do that by custom js and not When the form is saved rule.
but what i faced here that if i am changing the Request Submit field value to false if the form is not saved i am loosing the functionality of a rule that’s checking the required fields when the Request Submit is true. -
August 21, 2019 at 19:41 #26765
OK, I’m glad you found a workaround.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.