drupal_goto is not refreshing the webform on submit I have a webform node. I need the users to fill it and on submit, the user will be redirected to some link.

if ($form_id == 'webform_client_form_970') {
    $form['#submit'][] = 'dl_pdf';
}


function dl_pdf(){
        drupal_goto("http://dev.site.com/ar/printpdf/9", $options); 
    }


When the form is submitted, drupal_goto works ( it actually just downloads a PDF file automatically ) but the form does not get refreshed.

What i have been doing wrong. Any clue?

Solution:

if ($form_id == 'webform_client_form_970') {
        //$form['#submit'][] = 'dl_pdf';
        drupal_add_js(
            'jQuery(document).ready(function () { 
                jQuery(".webform-submit").on("click", function(){
                    var win = window.open("'.dl_pdf().'", "_blank");
                    win.focus();    
                });
            });',
        array(
            'type' =&gt; 'inline', 
            'scope' =&gt; 'footer', 
            'weight' =&gt; 5
            )
        );
    }

function dl_pdf(){
        return "http://dev.site.com/ar/printpdf/9?name=".$userinfo-&gt;title."&amp;date=".$course_date."&amp;course_type=off-non-reg&amp;course_name_ar=".$courseinfo-&gt;title.""; 
}
If you redirect to a URL that does not return a page but instead returns some other type of resource (such as a PDF in this case), then the current page will not be refreshed, as you have observed, because the response to the form request is returning the PDF, not HTML.

If you want the page to be refreshed as well then a common technique is to return the HTML for the new page from the form, and then redirect again to return the PDF. Because you need the new page to load fully (so the browser renders it), you'll need to use JavaScript to provide the redirect to the PDF. You can have a link in the page as well, to say something like "If the file does not download automatically, click here".