Jul 27, 2021 4:13 PM
Hi, I can't get values from my iframe form. I need to take extracted values and pass it to a third party api.
This is how I'm trying it:
Based on this answers this is how it seems you do it:
But my code doesn't work. I have confirmed my names are correct.
How do you get hubspot iframe form values.
Jul 27, 2021 5:37 PM - edited Jul 27, 2021 5:43 PM
Since you are working within the onFormSubmit try using the $form instead of your jquery object.
//Change this firstName = jQuery('input[name=firstname]').val(); //To this firstName = $form.find('input[name=firstname]').val();
I believe the issue is that by just using the "jQuery" object you are working within the object, and not within the form's iframe. Switching to use the $form object should place you in the correct scope.
Or if you wish to avoid using jQuery entirely you can use:
Just ensure that this form is the first and only form on your page, hence the "hs-form-iframe-0" id.
✔️ Was I able to help answer your question? Help the community by marking it as a solution.
Still have questions? Let's Talk