Home › Forums › Classic DFFS › Save Button Options
- This topic has 8 replies, 3 voices, and was last updated 6 years, 2 months ago by CinderGirl.
-
AuthorPosts
-
-
September 28, 2018 at 03:15 #22214
Hey there! Couple of questions for the Save button:
1. Is there a way to change the text so it reads ‘Submit’?
2. How can I change the redirect to go to a specific site page?Found some old posts from 2015 but then saw the options under Misc and was wondering if those were used to solve for this? Couldn’t find any info on “Save and redirect” in the User manual?
TIA!!
-
September 28, 2018 at 05:04 #22218
1. Here’s some code I have used in the past to change the text on the Save button:
function changeSaveButton(currLabel,newLabel){
var inputcontrols = $(‘input’);
alert(inputcontrols.length);
for(i = 0; i<inputcontrols.length; i++)
{
if(inputcontrols[i].type == “button” && inputcontrols[i].value == currLabel)
inputcontrols[i].value = newLabel;
}
}2. Redirecting the user to a specific page after clicking Save can be done with basic SharePoint functionality. Simply include the url of the page you want the user directed to after they save OR cancel the New form by including it as the Source querystring parameter on the link they click to open the new form on your list.
For instance, if your list is named MyList, and you want the user to go to a page called ThankYou.aspx located in your Pages library after they save or cancel, give them this link to click to start a new item: http://myserver/sites/MySite/Lists/MyList/NewForm.aspx?Source=/sites/MySite/Pages/ThankYou.aspx.
-
September 28, 2018 at 16:22 #22224
Thanks again! Will give this a try shortly 🙂
-
September 28, 2018 at 18:58 #22226
Hey Keith,
So when I use the function, errors pop up. Here’s the changes I made. Can you help me figure out what I did wrong?
Errors:
1. DFFS: There is an error in the custom JS textarea, could not complete the operation due to error 80020101.
2. DFFS Confi error in “Run these functions/trigger these rulesI’m just calling function changeSaveButton.
function changeSaveButton(Save,Submit){
var inputcontrols = $(‘input’);
alert(inputcontrols.length);
for(i = 0; i<inputcontrols.length; i++)
{
if(inputcontrols[i].type == “button” && inputcontrols[i].value == currLabel)
inputcontrols[i].value = newLabel;
}
} -
September 30, 2018 at 13:58 #22245
Hi,
I guess these error are caused by wrong type of quotes in the code snippet (caused by copy-paste from the comment). Try retyping all quotes in the snippet.Redirecting to another page can also be done using this built in DFFS function:
spjs.dffs.redirect("TheRedirectURL",false);
Depending on the SharePoint version this might not work, but if you are able to control the URL you can use the Source parameter like Keith described.
You can also target the save button directly by its id (using a selector where id ends with):
jQuery("input[id$='_diidIOSaveItem']").val("New save btn label");
Alexander
-
October 2, 2018 at 03:02 #22293
Sigh, yep. Again, so obvious looking at it now. The issue was the quotes. And I’m usually good with modifying those. Thanks for pointing that out! In the end I used Alex’s version because after fixing the quotes, it was still giving me an error, stating the currLabel value wasn’t set, so I must have change the wrong value.
And the redirect worked great! I’m using Keith’s version for a link on a site page and Alex, using yours on the form pages.
Thanks!!
-
October 2, 2018 at 05:53 #22310
Alexander,
Hey Alexander,
Is there a version of this for the Edit button? Scoured the forums and found a version for the Cancel button but not for Edit on the dispform.Save: jQuery(“input[id$=’_diidIOSaveItem’]”).val(“Submit This”);
Cancel: jQuery(“input[id$=’_diidIOGoBack’]”).val(“Cancel This”);Gave EditItem a shot but that was a no-go lol.
TIA!!
-
October 2, 2018 at 20:42 #22320
Hi,
Add this to your Custom JS in DispForm:jQuery("#Ribbon\\.ListForm\\.Display\\.Manage\\.EditItem-Large span:last").html("New<br>Label");
Alexander
-
October 8, 2018 at 17:02 #22388
Works perfectly! Thank you!
-
-
AuthorPosts
- You must be logged in to reply to this topic.