0

In SharePoint Designer 2010 I have a Submit and Cancel Button, however I am trying to add an additional button which when clicked updates a field value and then redirects the page. How do you do this please?

6
  • Can you provide a bit more information? Where does the value come from? Does the value need to come from user intervention (example: they have to fill in a field) or is it something like updating a status? Commented Jan 8, 2016 at 22:48
  • My bad , all items ( fields are from the same list). Updating status : When clicking on the button , let's call it "Reject" : Status changes to reject , triggers a workflow to send email and then the page is redirected to another page. Commented Jan 8, 2016 at 22:53
  • Do you want Reject button also to submit the entire form data filled ?
    – Gaurravs
    Commented Jan 9, 2016 at 6:15
  • REJECT would just send everything as back to stage 1as is. Commented Jan 9, 2016 at 6:20
  • So to summerize, you need just the status to be saved as Reject ,and rest all fields should be retained as it was before opening the form
    – Gaurravs
    Commented Jan 9, 2016 at 6:33

2 Answers 2

0

This can be done with the help of jQuery. Create a button and give it an ID. Then create a jQuery click event that does what you need to do.

For reference see the jQuery docu here

Example: In the HTML create a button like this

<button id="rejectButton">
  Reject this
</button>

Then add Javascript to the page with your preferred method (for e.g. via a CEWP linked file) that has code along the lines of

$( "#rejectButton" ).click(function() {
  alert( "The Reject button has been clicked." );
});

Instead of the alert, use jQuery or Javascript to set the value of your desired field, then submit and redirect to another page. There are plenty of code samples on the interwebs to do this. Just search for "sharepoint list redirect after submit" for a few ideas.

4
  • No need for separate code or jQuery, you can do <button onclick='javascript:{PUT ALL YOUR CODE HERE}'/> Commented Jan 9, 2016 at 9:14
  • Thank you teylyn and Danny. Please pardon my low knowledge of coding I will have to find out how to update a field - list item - using jquery. Commented Jan 9, 2016 at 17:59
  • @DannyEngelman jQuery will be a lot easier for identifying and manipulating the fields that need to be changed upon button click.
    – teylyn
    Commented Jan 9, 2016 at 22:02
  • @MikeRooker, jQuery is for DOM manipulation and all sorts of stuff that can also be done with vanilla JavaScript, especially with modern browsers standardized on ES5 and ES6. For interaction with SharePoint you need JSOM (msdn.microsoft.com/en-us/library/office/…) Commented Jan 10, 2016 at 8:43
0

I actually provided an answer to a question similar to this a couple of weeks ago. It was for SP2013, but the steps should be similar in 2010. Basically you want to create your workflow, get the GUID of the workflow, add a button to your form or ribbon and call the WF passing in a "Source" variable in the URL address, forcing the page to redirect as you require.

You can find the answer with more details at: Customizing the Source URL (redirect URL) after a Workflow launched by a Quick Step in SharePoint 2013

Hope this helps.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.