Save as Draft button

Forums General discussion Save as Draft button

Viewing 1 reply thread
  • Author
    Posts
    • #27478
      Anne Maki
      Participant

      Hello,

      I’ve created a custom button called “Save as Draft”, but am a little stuck on how to program the functionality for it. What I need is when the user clicks on this button, I would like to set a field to a particular value, have all the input so far saved in the list, and somehow bypass any requirements for required fields (e.g. if a user hasn’t put in all required fields yet, that’s OK, the “Save as Draft” form will still save all input so far.

      What is the best way to do this?

      Thanks,
      Anne

    • #27480
      Alexander Bautz
      Keymaster

      Add this to your Custom JS:

      function saveAsDraft(){
          setFieldValue("Draft", true);
          spjs.dffs.data.requiredFields = [];
          spjs.dffs.triggerSave();
      }

      Then call the function from your button like this:

      <input type="button" value="Save as draft" onclick="saveAsDraft();return false;">

      The filed “Draft” in the saveAsDraft function is a boolean (Yes/No) field.

      Please note that this will ONLY work for required fields set in DFFS and NOT for required fields set in the SharePoint list settings.

      Let me know how this works out.

      Alexander

Viewing 1 reply thread
  • You must be logged in to reply to this topic.