Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How to use HubSpot Forms API in Wordpress pages?

I have to pass dynamic values to the Hubspot Form.

Thanks in advance

share|improve this question
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!! –  Maruti Mohanty Nov 12 '13 at 12:11

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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