Is it possible to use a relative "thank-you.html" url as my custom Thank you page instead of "www.mydomain.com/thank-you.html"?

  • slfattorneys
    Asked on June 30, 2015 at 12:33 AM

    My goal is to use one simple common form on multiple websites.  I am only asking for Name, Phone, E-mail, and Message - the same questions on all my websites.  

    I will be the only recipient for all the forms from all the websites.

    However, once a visitor submits the form, I want them to be taken to the "/thank-you.html" page for that website.

     

    Using a absolute url (mydomain.com/thank-you.html) restricts my form to just one website.  However, if it is possible to use a relative url (/thank-you.html), than it wouldn't matter which website my visitor completes the form because they would be redirected to the thank-you page for that given domain.

     

    I hope I have articulated my thoughts properly. 

    Thanks for your assistance.

    Chet

  • Ashwin JotForm Support
    Replied on June 30, 2015 at 4:23 AM

    Hello Chet,

    Please be noted that there is no built in feature to dynamically add the domain URL in the "Custom URL" of the thank you setting but with a little workaround it is possible to achieve your requirement. Here are the steps you should follow:

    #1. Add a textbox field in your form and hide it.

    #2. Get the field id of this textbox. The following guide should help you:  http://www.jotform.com/help/146-How-to-find-Field-IDs-Names 

    #3. Add the field name in the custom thank you URL of your form followed by the thank you page.

    #4. Grab the desired embed code of your form and populate the hidden field with the URL wherever you are embedding your form. The following guide should help you:  http://www.jotform.com/help/71-Prepopulating-fields-to-your-JotForm-via-URL-parameters 

    Now When the form is submitted, it will read the prepopulated textbox value and add it in the custom thank you URL.

    Please check the screenshot below:

    Is it possible to use a relative thank you Screenshot 20

     

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!

  • slfattorneys
    Replied on June 30, 2015 at 10:46 AM

    Hi, Thanks for the quick reply.  Very interesting, I will definitely have to try this.

    Thanks for the video demonstration, makes it so much easy to follow instructions.

     

    Chet

  • Ashwin JotForm Support
    Replied on June 30, 2015 at 12:34 PM

    Hello Chet,

    Your\ are welcome. I am glad to know that you liked the video demonstration.

    Do try it out and get back to us if you have any questions.

    Thank you!

  • slfattorneys
    Replied on July 1, 2015 at 7:48 PM

    This works PERFECTLY!!  Thank you so much.

    It's too bad these variables only work when statically defined, and not be defined by a php include.

     

    Thanks,

    Chet

  • Ashwin JotForm Support
    Replied on July 2, 2015 at 12:17 AM

    Hello Chet,

    You are welcome. 

    Please be noted that the field names with {..} anywhere in the form are automatically parsed and replaced by our backend system. These variables are set/read within the form backend code and cannot be set manually. The only option is to prepopulate the fields as I have explained above.

    Can you please explain a little more in detail how you want to use the PHP code?

    Thank you!

  • slfattorneys
    Replied on July 2, 2015 at 12:29 AM

    Sure,  

    For my form, the field id of the website variable is {website}.

    I would have loved to use this instead: {<?php include("php/google-analytics-domain.php"); ?>}.

    My php include would pull in this value: {middletownsmallbusinessloans.com}.

    The reason for the php include: So, i can use the same jorform code in multiple websites without the need to edit {website} from 1 website to another.

    No worries.  Since I will be embedding the source code, I will manually insert my php code as such: 

    <input type="hidden" class="form-hidden" value="<?php include("php/google-analytics-domain.php"); ?>" id="input_9" name="q9_website" />

    And my thankyou url would be: {website}/thank-you.html

    Problem solved. Now, I can embed my the same jotform code for multiple websites without the need to edit the source code for each site because each website will have defined php include for the website url.

     

    Thanks for giving me this workaround!

    Chet

  • Ashwin JotForm Support
    Replied on July 2, 2015 at 1:58 AM

    Hello Chet,

    I understood your requirement.

    Well you cannot directly include a PHP file to read the value but you can read a PHP value and pass it to as URL parameter to your form.

    example:

    <input type="hidden" class="form-hidden" value="<?php echo $PHP_VARIABLE; ?>" id="input_9" name="q9_website" />

    or use it directly in your form's embed code:

    <iframe id="JotFormIFrame" onDISABLEDload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotformpro.com/form/51749051922961?website="<?php echo $PHP_VARIABLE; ?>"" frameborder="0" style="width:100%; height:1126px; border:none;" scrolling="no"></iframe>

    You can write some PHP code to populate the PHP variable. I am not a PHP programmer but this concept should work in any web programming (you will have to check the syntax though).

    Thank you!