Joe Penland

Forum Replies Created

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • in reply to: Redirect after save/cancel #36522
    Joe Penland
    Participant

    I realized I didn’t really explain my purpose. I want to set up the function so it can dynamically pull the redirect destination from the URL search parameters because the page I link FROM may change and I am putting the current page in the search parameters under a “DFFSSource” parameter. If that parameter is present, I want to redirect users to whatever URL is passed. I am testing with “https%3A%2F%2Fwww%2Egoogle%2Ecom” as the source and it logs correctly in the console as https://www.google.com just before navigating to Google when I test by clicking a button. When I cancel the form, nothing logs to the console and nothing happens. I don’t get errors, I just don’t get anything.

    in reply to: Redirect after save/cancel #36521
    Joe Penland
    Participant

    I also tried with this but still, I can see the action take place on clicking a button, but not on cancelling the form.

    function saveCancelRedirect() {
    let searchParams = new URL(document.location).searchParams;
    let dffsSource = decodeURIComponent(searchParams.get(“DFFSSource”));
    console.log(‘dffsSource:’);
    console.log(dffsSource);
    console.log(typeof dffsSource);

    if (dffsSource !== undefined && dffsSource !== null && dffsSource !== ‘null’) {
    location.href = dffsSource;
    }
    }

    in reply to: Redirect after save/cancel #36520
    Joe Penland
    Participant

    For some reason it doesn’t seem to be working for me. We are still running v1.0.12.0, but I believe that version includes support for detecting the cancel event.

    I have this in the Custom JS of the New form:

    function saveCancelRedirect() {
    let searchParams = new URL(document.location).searchParams;
    let dffsSource = decodeURIComponent(searchParams.get(“DFFSSource”));
    console.log(‘dffsSource:’);
    console.log(dffsSource);
    console.log(typeof dffsSource);

    if (dffsSource !== undefined && dffsSource !== null && dffsSource !== ‘null’) {
    console.log(‘Redirect to ‘ + dffsSource);
    }
    }

    function dffs_PostSaveAction() {
    saveCancelRedirect();
    }

    function dffs_PostCancelAction() {
    saveCancelRedirect();
    }

    I am able to trigger the function by clicking a button, but it is not triggering when I cancel or close the form.

    in reply to: Redirect after save/cancel #36517
    Joe Penland
    Participant

    Thanks for your reply. I did see those examples, but I haven’t successfully gotten my functions to trigger when the form is closed or cancelled. I am not seeing the cancel event as something I can use as a trigger.

    in reply to: Redirect after save/cancel #36515
    Joe Penland
    Participant

    I am finally getting back around to try this out and am having a bit of trouble trying to figure out how to trigger a function on cancelling a form. I don’t see a cancel event in the triggers for the rules. How do I attach my function to a cancel event?

    I appreciate your help.

    in reply to: Redirect after save/cancel #36447
    Joe Penland
    Participant

    Thank you! I really appreciate it.

    in reply to: Redirect after save/cancel #36445
    Joe Penland
    Participant

    Thank you. Yes, in this instance I am sending users to the form from another page, so I want them to come back whether they save or cancel in the form. This would also apply if I just show them the display form for an item and they close it. I would like to send them back to the page of my choice. Adding a way to detect cancelling would be very helpful in order to handle both cases (save and cancel or close).

    in reply to: Direct link to forms? #36380
    Joe Penland
    Participant

    Thanks for the quick response! I was expecting this answer, but thought I should ask just to confirm before giving up hope. I appreciate it!

Viewing 8 posts - 16 through 23 (of 23 total)