Home › Forums › Classic DFFS › Create Approve button within the editform
- This topic has 5 replies, 3 voices, and was last updated 7 years, 11 months ago by Alexander Bautz.
-
AuthorPosts
-
-
June 23, 2016 at 21:22 #12108
Hello,
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,
Dave
p.s. I’ve included a version of what the screen looks like.
Attachments:
-
June 29, 2016 at 06:05 #12157
Hi,
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":spjs.dffs.data.thisItemID,"data":data}); if(res.success){ alert("Approved!"); location.href = location.href; }else{ alert(res.errorText); } }
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,
Alexander -
December 21, 2016 at 20:40 #14617
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?
-
December 28, 2016 at 19:48 #14681
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”.Alexander
-
December 30, 2016 at 14:02 #14699
That was it! That worked. Thank you, Alexander. You are the best!
-
December 30, 2016 at 23:43 #14703
I’m glad it worked.
Happy new year!
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.