Create Approve button within the editform

Forums Classic DFFS Create Approve button within the editform

Viewing 5 reply threads
  • Author
    • #12108
      David M


      I’m using Dynamic forms within my SPD workflow in SP 2010.

      For approvals, I currently have a radio button date field and also a comment field. Is it possible to have an approval button inside the form?

      There is a post of approval buttons in the header which I’ve read, but I’m trying to see if it is possible to put one inside the form.

      If there is a way to have an ‘Approval’ button, which then inserts the username and Time/date stamp into another field that would be ideal.

      Thanks so much,


      p.s. I’ve included a version of what the screen looks like.

    • #12157
      Alexander Bautz

      If you want to insert the username and date by code and refresh the page (most likely in DispForm) you can add this code to the custom js textarea:

      function myCustomApproveFunction(){
          var data = {}, today = new Date(), res;
          data.PeoplePicker1 = _spPageContextInfo.userId;
          data.DateColumn1 = today.getFullYear()+"-"+(today.getMonth()+1)+"-"+today.getDate()+" 06:00:00";
          res = spjs.utility.updateItem({"listName":_spPageContextInfo.pageListId,"id","data":data});
              location.href = location.href;

      You must change “PeoplePicker1” and “DateColumn1” to your own field names.

      Then add this to a html section in one of your tabs:

      <input type="button" value="Approve item" onclick="myCustomApproveFunction();return false;">

      If you however wants to insert this information when doing a “hand editing” of the item in EditForm (to automate filling the PP and the date picker) you can use a rule and the “Set field value” option.

      Hope this helps,

    • #14617
      Rich Rockwell

      Alexander, thanks for this.

      I’m not able to get it to work. I click the button and nothing happens. When I debug it, I get the message “Object doesn’t support property or method ‘updateItem'” Any suggestions?

    • #14681
      Alexander Bautz

      Hi Rich,
      The method “updateItem” is part of the spjs-utility.js file. If you are using an older version of this file you can try changing “spjs.utility.updateItem” for “spjs_updateItem”.


    • #14699
      Rich Rockwell

      That was it! That worked. Thank you, Alexander. You are the best!

    • #14703
      Alexander Bautz

      I’m glad it worked.

      Happy new year!


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