My name is Lucas and I saw a post in the community about how to put the form parameters in the url .I’m creating 6 forms in a row that after you reply one you are redirect to the other and so on.
Hey @LInnocentini the other community post you’ve linked is actually exactly what you’re looking for, my only suggestion would be to use “onFormSubmitted” instead of “onFormSubmit” since using window.location onFormSubmit can cause a race condition that may redirect the page prior to the submission happens.
Other than that you can follow that post exactly, just replace the Country property with the email property.
Hey @LInnocentini there’s no way to add the code to a HubSpot form module, this can only be done through the embed code. If you go into your forms and copy the embed code, you can customise that code and then paste it anywhere you like. If you want to add it to HubSpot I’d recomend creating a custom module for it.
Just FYI you will need a bit of familiarity with Javascript to implement it or troubleshoot it correctly, so if you don’t you may need to consult a web developer to fully implement!
So I’ using the following embed code in my shopify website, but is returning me this https://minimalclub.com.br/pages/pagina-para-teste-2?email=undefined
<!--[if lte IE 8]>
<script charset=“utf-8” type=“text/javascript” src=“//js.hsforms.net/forms/v2-legacy.js”></script>
<![endif]-->
<script type=“text/javascript” src=“//js.hsforms.net/forms/v2.js” charset=“utf-8”></script>
<script>
hbspt.forms.create({
portalId: ‘XX708XX1’,
formId: ‘2b9XXdXX-43fX-4XX4-XXc4-18cXXf33XX06’,
inlineMessage: ‘Você está sendo redirecionado’,
onFormSubmitted: function($form){
var emailWeb = $form.find(‘input[name=“email”]’).val(); // Alteração no nome do campo para “email”
setTimeout(function() {
window.location.href = “https://minimalclub.com.br/pages/pagina-para-teste-2?email=” + encodeURIComponent(emailWeb);
}, 500); // Redireciona para a URL com o parâmetro “email” após meio segundo.
}
});
</script>
Hey @LInnocentini any particular reason you’re adding a property for “emailWeb” instead of just the email field? It seems like that property was never called or defined in your code.
Hi @TomM2. I name like that for no particular reason.
I rename the var to just email, but I don’t think that will solve the issue. Do you have any ideia of what should I try?
<!--[if lte IE 8]>
<script charset=“utf-8” type=“text/javascript” src=“//js.hsforms.net/forms/v2-legacy.js”></script>
<![endif]-->
<script type=“text/javascript” src=“//js.hsforms.net/forms/v2.js” charset=“utf-8”></script>
<script>
hbspt.forms.create({
portalId: ‘XX708XX1’,
formId: ‘2b9XXdXX-43fX-4XX4-XXc4-18cXXf33XX06’,
inlineMessage: ‘Você está sendo redirecionado’,
onFormSubmitted: function($form){
var email = $form.find(‘input[name=“email”]’).val();
// Alteração no nome do campo para “email”
setTimeout(function() {