Discussions

Expand all | Collapse all

Redirect to another page when 'cancel' button is clicked

  • 1.  Redirect to another page when 'cancel' button is clicked

    Posted 04-24-2017 21:19
    I have a link on a main dashboard page, which when clicked redirects to an edit record page with the main dashboard page as the nexturl(). When I click on save button, it works as it should and redirects the page to main dashboard. However, when I click on the cancel button, it stays on the same record but in view mode. Is there a way for the nexturl to work with cancel button as well?

    Thanks.


  • 2.  RE: Redirect to another page when 'cancel' button is clicked

    Posted 04-25-2017 03:29
    Natively the cancel button just amends an href='#' to the call. So you would need to make a custom cancel button if you wanted to control the redirect.

    This is straight from the "Magic Button" app, 

    "<a class='Vibrant Success' onclick='DoSaveCancel()' href='#'>Cancel</a>"

    So you would need to add your end URL to the href.

    Another option is to pass the "Cancel" URL via the original button push.
    Basically it would write to a URL field, then your cancel button would use that URL in the cancel href.

    Say my [Cancel URL] is field 20, you can add

    &_fid_20="&URLEncode(www.google.com)&"

    Then your Cancel button would look like:

    "<a class='Vibrant Success' onclick='DoSaveCancel()' href='&[Cancel URL]&'>Cancel</a>"


  • 3.  RE: Redirect to another page when 'cancel' button is clicked

    Posted 04-25-2017 16:22
    I understand. Thank you!