Redirect to different locations when submitting EditForm

Forums Classic DFFS Redirect to different locations when submitting EditForm

Viewing 3 reply threads
  • Author
    Posts
    • #17259
      Michal Riha
      Participant

      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

    • #17327
      Alexander Bautz
      Keymaster

      Hi,
      You can use this snippet in each of your functions:

      spjs.dffs.redirect("TheRedirectURL",false);

      Let me know how it works out.

      Alexander

    • #17418
      Michal Riha
      Participant

      Hi Alexander,
      it is not working – no redirection is done.
      Michal

    • #17437
      Alexander Bautz
      Keymaster

      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

Viewing 3 reply threads
  • You must be logged in to reply to this topic.