Answered

Back to homepage with embedded form

  • 29 June 2023
  • 5 replies
  • 115 views

Badge

We use our forms on different sites and so when the user completes the form, I’d like to send them back to the appropriate homepage.

I’ve tried:
- Relative link: setting the button link to “/”, but it says “This URL doesn’t look right” and the value doesn’t get saved when I hit publish (I hit publish, refresh the page, the Button Link is turned off)


- Sending the value of `window.location.host` as a hidden variable to our forms and using “https://@host” as the button link but that has the same issue of “This URL doesn’t look right” and not getting saved.

- The answer cannot be n different ending pages, that’s ridiculous. 


The URL should be saved and used even if the URL validator doesn’t think it’s valid

icon

Best answer by mathio 3 July 2023, 09:30

View original

5 replies

Userlevel 7
Badge +5

Hi @ChompyThePenguin Happy Thursday! I hope you’re having a good week so far. 

If you’re referencing the redirect feature, you will need to put a full URL in here in order for this to work. I’d suggest placing the URL of your homepage into this feature to send respondents back to the homepage. 

Badge

Sorry, maybe I was unclear.

We have multiple websites where we embed the form, for example

chompyExample.com, penguinExample.com, etc

We want to make sure to send the user back to the right website, so:

- Ideally, there would just be an option to allow the button to close the form on completion, so that I don’t have to specify a link at all

- Absent that, I’ve set it up so all forms receive a hidden variable, “host”, that is the current website (“chompyExample.com” or whatever).  Generally, these hidden variable are able to be used in the redirect URL (documentation), but in this case, even though I can put the host in the URL (“http://[host]”) it won’t let me save it as such:

 


 

Userlevel 7
Badge +5

Ah, got it, @ChompyThePenguin ! You will need to enter the URL of each website, I’m afraid.

@mathio might have some handy workarounds for you!

Badge

Yeah, the host variable has the correct domain so it would be the correct URL.  That’s all that is needed.  The only problem here is that the form doesn’t think it “looks right”, so it won’t save it.

@mathio Any suggestions?

Userlevel 7
Badge +5

I agree, it is unfortunate you can not use a hidden field like this. I think this is a good candidate for a support / feature request, please file one here: https://www.typeform.com/help/contact/360000516211

 


 

If you can embed your typeform in your website, you can use our embed SDK to solve this.

  1. You can embed it as a popup on your homepage and automatically close the popup - use the autoClose option (code example).
  1. Alternatively you could use on of the following callbacks to execute custom code (eg. redirect in your case):
    1. onSubmit (code example)
    2. onEndingButtonClick (code example)

Hope this helps.

Reply