Home › Forums › General discussion › Save for later Button
Tagged: button, save for later
- This topic has 11 replies, 2 voices, and was last updated 3 years, 10 months ago by Alexander Bautz.
-
AuthorPosts
-
-
April 6, 2019 at 21:17 #24720
Is there a way to add a button that will say “Save for later”, button that will change a Boolean value to Yes and then save the item/form.
Say I have a boolean column called: “Save for later”. I will program my Flow to ignore this task if this column has a value “Yes”.
Can I add a button, rather than a field/option, that will change the value to Yes in the background, and then saves the form?
When the item is edited and the creator clicks on Submit (or save) button, the value would change to “No”.
- This topic was modified 5 years, 8 months ago by Maciek Grischke.
- This topic was modified 5 years, 8 months ago by Maciek Grischke.
-
April 7, 2019 at 11:40 #24726
Add this to your Custom JS:
// When loading the form it should set the boolean column to false setFieldValue("SaveForLaterBoolean",false); // Insert button jQuery("input[id$='_diidIOSaveItem']").before("<input type='button' class='ms-ButtonHeightWidth' style='margin-right:4px;' value='Save for later' onclick='saveForLater()' />"); function saveForLater(){ setFieldValue("SaveForLaterBoolean",true); spjs.dffs.triggerSave(); }
Change “SaveForLaterBoolean” to match your boolean field internal name.
Let me know how it works out.
Alexander
- This reply was modified 5 years, 8 months ago by Alexander Bautz. Reason: Added spjs.dffs.triggerSave();
-
April 7, 2019 at 19:27 #24729
Thanks Alexander,
works beautifully 🙂
I knew I could count on you.
Many thanks, as always!
-
April 8, 2019 at 20:29 #24736
Alexander, is it possible to have “Save for later” button in DisplayForm?
-
April 9, 2019 at 17:09 #24742
I’m not sure how you would use it in DispForm – there is not saving going on there – please explain.
Alexander
-
April 28, 2019 at 11:16 #25056
Hi Alexander,
I think what I meant was to be able to re-open the previously closed ticket.
I asked another question in a separate thread, but it’s for EditForm – I asked about hiding buttons based on fields values.
I think once the ticket is closed, I will want to hide Edit Button or change it to Re-open ticket and set the Status value to Open, and to re-open the ticket, the user will only be able to do this from DispForm. Is it possible to do from DispForm?
-
April 29, 2019 at 17:33 #25086
Hi,
Yes, you can add a button that calls a function like this:function reopenTicket() { var res = spjs.utility.updateItem({ "listName": _spPageContextInfo.pageListId, "id": spjs.dffs.data.thisItemID, "data": { "Status": "Open" } }); if (res.success) { // Status set successfully } else { alert(res.errorText); } }
Change “Status” to match your field name and “Open” to the value you like to set.
Alexander
-
April 29, 2019 at 23:17 #25104
Thanks,
The only problem I have is that I can’t figure out what is the ID of Edit Button.I tried this (and few other IDs):
// Insert button jQuery("input[id$='_editItem']").before("<input type='button' id='_editItemBtn' class='ms-ButtonHeightWidth' style='margin-right:4px;' value='Re-open this ticket' onclick='saveForLater()' />");
but no luck 🙁
-
April 30, 2019 at 15:34 #25135
You must use the developer tools: right click the button and select “inspect” and you will find the id is dffs_editItemBtn.
The only thing you must do is to set a 1100ms timeout because this edit button is inserted by DFFS after a 1000ms timeout – the extra 100ms ensures your snippet will find it:
setTimeout(function(){ jQuery("#dffs_editItemBtn").before("<input type='button' id='_editItemBtn' class='ms-ButtonHeightWidth' style='margin-right:4px;' value='Re-open this ticket' onclick='saveForLater()' />"); },1100);
Alexander
-
April 30, 2019 at 15:41 #25139
Brilliant, this worked. I did try with dffs_editItemBtn, but I was missing the delay function. Thanks again as usual!
-
February 4, 2021 at 17:23 #32696
Hi Alexander,
is there a way to move the additional button (Save for Later) up within the form?
-
February 4, 2021 at 20:43 #32699
You can move an item like this:
jQuery("#Id_of_element_to_move").appendTo(jQuery("#id_of_element_to_move_into"));
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.