Forum Discussion

RizuGulati's avatar
RizuGulati
Qrew Cadet
8 years ago

Redirect to another page when 'cancel' button is clicked

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 Replies

  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    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>"