Custom Save Button

Home Forums Classic DFFS Custom Save Button

Viewing 7 reply threads
  • Author
    Posts
    • #9717
      Jon Whisman
      Participant

        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>

      • #9735
        Alexander Bautz
        Keymaster

          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

        • #26739
          HYM
          Participant

            in case the form was not save because of some required fields how to reset these fields values?

            for example checkbox, was set to true when the button is clicked if the form is not save the checkbox should be set to false.

            • This reply was modified 5 years, 3 months ago by HYM.
          • #26746
            Alexander Bautz
            Keymaster

              I’m not sure I follow – if the form is not saved the checkbox value is not saved either… – can you explain?

              Alexander

            • #26754
              HYM
              Participant

                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;
                        }
                    });
                }
              • #26756
                Alexander Bautz
                Keymaster

                  OK, you might also use the “The form is saved” trigger as it will only be run if all required fields are filled.

                  Alexander

                • #26758
                  HYM
                  Participant

                    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.

                  • #26765
                    Alexander Bautz
                    Keymaster

                      OK, I’m glad you found a workaround.

                      Alexander

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