CMS Development

MarkdeLange
Top Contributor | Partner
Top Contributor | Partner

Validation routine using Java script

We have created a validation routine on a campaign. This is to prevent that users claim an incentive incorrectly.

 

Users land on a hubspot landing page with an ID code we capture in a hidden field. After users complete the form with their address, we validate that the ID code has not been used before and that it is valid. The validation script executes , triggered when the form is submitted. If the validation is OK users pass to a Thank you page, else they get on screen error messages.

 

Two questions

1) There are instances where the form is submitted,  data passes to the validation database, but the form does not get submitted in Hubspot. I thought this could be down to intermittant internet access, but the errors are higher so I expect this may be due to another reason.

2) I would like to make sure this use of Java script (this is in a script module, not in the form itself) will not stop working with the planned change in forms. I read we can't use html in the form fields and scripts in forms can also not continue. 

 

Regards,

Mark

I am not sure how I can validate this will continue working.

0 Upvotes
1 Reply 1
lscanlan
HubSpot Alumni
HubSpot Alumni

Validation routine using Java script

Hi @MarkdeLange,

 

Some answers to your questions:

 

1)

I think for this one I need to know a little bit more about how you have your form set up. Do you have a page I could look at where this is happening? Is it a HubSpot for on a HubSpot-hosted page? If it is, are you customizing the form with an embed code or something similar? It could be that if you're using the callbacks, maybe the timing is off, and so the submission isn't actually being persisted.

 

2)

No functionality should change regarding JavaScript in a separate script tag. But again I'm happy to take a look if you have a page you could link me to.

 

Leland Scanlan

HubSpot Developer Support
0 Upvotes