› Forums › Classic DFFS › Redirect to different locations when submitting EditForm
- This topic has 3 replies, 2 voices, and was last updated 6 years, 9 months ago by Alexander Bautz.
-
AuthorPosts
-
-
July 13, 2017 at 08:58 #17259Michal RihaParticipant
Hi Alexander,
I have these buttons in EditForm:<input id="btnAction1" class="customBtn" type="button" value="ACTION1" onclick="fnAction1();return false;"> <input id="btnAction2" class="customBtn" type="button" value="ACTION2" onclick="fnAction2();return false;"> <input id="btnAction3" class="customBtn" type="button" value="ACTION3" onclick="fnAction3();return false;"> <input id="btnAction4" class="customBtn" type="button" value="ACTION4" onclick="fnAction4();return false;">
each button fill different values to form and call submit.
Is it possible redirect user to different locations (different views) after submitting depending on which button was use?
Is it possible to change Source= parameter in url?I tried to add this line
$(location).attr('href', 'https://sharepointtest/sites/DocLibraryTest/Forms/NOK.aspx');
it is working, but when there is some error in form at submitting (eg missing required field) – form is redirected immediatelly without possibility to correct form.
Many thanks
Michal
-
July 18, 2017 at 10:08 #17327Alexander BautzKeymaster
Hi,
You can use this snippet in each of your functions:spjs.dffs.redirect("TheRedirectURL",false);
Let me know how it works out.
Alexander
-
July 24, 2017 at 22:50 #17418Michal RihaParticipant
Hi Alexander,
it is not working – no redirection is done.
Michal -
July 25, 2017 at 09:15 #17437Alexander BautzKeymaster
This should work by setting the redirect-on-save to the new URL, but the actual redirect will only happen when the form is actually saved (using the default button).
If you like your custom button to set the redirect URL and save the form you need to add one line to your function to “click” the default save button.
I’ll have to see your current code to see how you “submit” the form to be able to help you further because my code example only works with the default save button and not with any custom submit function.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.