Pardot Knowledge Base

Passing a Redirect URL to a Form as a Hidden Field

Last Updated: Nov 23, 2015
Woah there, partner! This is an advanced topic that involves custom script. Troubleshooting custom script is outside of Pardot Support’s scope, so proceed with caution.

Occasionally you may want to make the redirect location of a Pardot form dynamic. To do this, you can pass the URL into the form via a hidden field and then call that URL with JavaScript in the form's Thank You Content.


  1. Create a custom field to store your redirect URL and set type to Hidden. Make sure this field is NOT set to record and display multiple responses, as this will cause an error in the redirect. Note the field's ID.
  2. Edit your form. On Step 2, add your hidden field. Go to the Advanced section and mark Always display even if previously completed. Save the field.
  3. While editing your form on Step 4 add the following JavaScript to your form's Thank You Code. You will need to update the two places where you see field_id towards the bottom of the script with the field ID of the custom field you created in the first step.
  4. In your iframe URL on your site, add ?field_id=redirect_url where field_id is your custom field’s ID and redirect_url is the URL redirect location that you want to send the prospect to upon completion. For example:
    <iframe style="border: 0;" src="" width="100%" height="500" frameborder="0"></iframe>


  • We recommend JavaScript-encoding your variable tags using {js}. This will prevent special characters from breaking your variable tag's output, and prevent arbitrary code from executing.