PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

leaving redirect blank to redirect download

  1. hugegoudaface
    Member

    I'm trying to redirect to a download upon submit. To do so, I'm passing an entire URL (a post thumnbail permalink) as the query string. But in order for this to work I'd need to leave the redirect field blank. When I do, and save, the changes don't stick - it seems like it needs something in the field to take.

    Posted 14 years ago on Thursday January 6, 2011 | Permalink
  2. If you have an entire URL you place the entire URL in the redirect field. The query string builder is only for creating a dynamic query string that passes form data as part of the redirect.

    It's best to redirect to a thank you message that contains a download link for the download.

    Posted 14 years ago on Thursday January 6, 2011 | Permalink
  3. hugegoudaface
    Member

    Oh but I feel like I'm so close, Carl! To be more clear, the URL is actually generated dynamically by retrieving the post thumbnail url with:

    add_filter("gform_field_value_url", "populate_url");
    function populate_url($value){
    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id,'large', true);
    return $image_url[0];
    }

    From a usability perspective, it's just way more elegant to have the download start upon submit. I guess then I'm making a feature request to allow save of form with a confirmation message redirect using a query string but the redirect field is blank.

    Posted 14 years ago on Thursday January 6, 2011 | Permalink
  4. Is the download file an image? Are you expecting the browser to start downloading the image? You realize this isn't going to initiate a download but rather simply display the image in the browser because of how browsers handle images right? It's slightly different than a zip file download which a browser can't display and therefore initiates a download and begins downloading the file.

    I'll see what we can do to handle this, but it's an odd use case.

    There are other ways to handle this, such as showing a thank you message and then using Javascript or the meta refresh to initiate a file download (ex. when you go to a page and it says "Your download will begin in..." message with a "if it does not click this link to download." just in case.

    The problem with this scenario is as I mentioned above, the browser is going to display the image right than actually initiate a standard download action where it asks for them to save or open the file.

    Posted 14 years ago on Thursday January 6, 2011 | Permalink
  5. hugegoudaface
    Member

    Carl, this is really helpful. The attachment would be a pdf so the download would initiate, or in some cases (safari) would be loaded into the browser - which is fine. It looks like we may pursue another method entirely, and this is include the download link in a reply email. But this conversation has been helpful.

    Posted 14 years ago on Thursday January 6, 2011 | Permalink