0

How to use HubSpot Forms API in Wordpress pages?

I have to pass dynamic values to the Hubspot Form.

Thanks in advance

1
  • 1
    What are HubSpot forms? When you add some third party plugins/apis in your question, it is better you add a link for the same for reference!! Commented Nov 12, 2013 at 12:11

1 Answer 1

1

The easiest way is to use HubSpot's PHP wrappers to get the data you need: https://github.com/HubSpot/haPiHP

Basically the wrappers are just JSON data fetchers, so you can also just take out the code you need from the wrapper source, if you need to.

Create new HubSpot_Forms instance and use e.g. the get_forms() to get the form data. Each form has an array field embeddedCode, which includes a javascript includer snippet, which outputs the form right where you output the field code. Then just use the JavaScript/JQuery method of your choice to populate the fields with your dynamic data.

If you need to populate fields without JavaScript, you'll have to find out the form field attributes, write your own form code and use the submit_form() method to post the data afterwards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.