I built a custom form for a website which you can access here. Is there a way I can use this form I have built and submit the form data to hubspot? Having a hard time figuring it out through api form docs. Any examples or more information would be really helpful. Thank you
would It be something like this? I dont have access to the server right now otherwise I would test it. Here is the example I just found on stackoverflow.
$str_post = “check_list=” . urlencode($check_list) if not is there an example you can show me or point me to? also I didnt close my inputs on purpose because when I did it wouldnt show up on the post
@Tim_Garlick THe best example is here on our docs.
The problem with using checkboxes is that they could click on more than one of them. You can’t assign more than one value to one property in HubSpot. Have you tried using radio buttons instead? Then in Javascript you can get the value of the selected radio button and pass it to your $check_list variable to encode and store in your Industry property.
@Tim_Garlick You need this at the end of that $str_Post line. I am not sure if that will solve the concatenation issue but it is one thing we need to edit.
. "&hs_context=" . urlencode($hs_context_json); //Leave this one be
I think I figured that part out. I am now getting a 204 response when I send my form; However, no data is being captured and when I try to add a multi select checkbox I get a concatenation error. On my form I have multiple inputs that are both radio select and multi select. I will post my code example. In my form my first input is and other inputs with the same name but other values that follow. In my php code I get a concatenation error. My php code is $str_post = “industry=” . urlencode($manufacturing;$asset_tracking;$distribution;$service;warehouse) with many others that follow. I have everything set up on the hubspot forms to match the same name and value pairs. Not sure where I am going wrong. Anything you can see?
@Tim_Garlick I’m guessing there should be only one variable associated to it. You should have one variable that will hold there answer regardless of what it is. Then pass that. Also it looks like you for the ‘$’ in front of warehouse. Can you grab the selected response to the multi checkbox? That way you don’t have to pass every response whether they clicked it or not.
I am basically just copying over the php code from that link you sent me. I am running into issues with the end point. If I custom code my own form what end point am I supposed to be pointing my form to? What action should I be putting down on my form? I was able to quickly throw something together when creating a form through hubspot but not my own form. I dont know what guid to put down or portal id to put down. Sorry I am new to hubspot so any added help would be appreciated.
Your Hub ID is a unique number assigned to every portal/account in HubSpot. Here's how to find it.
The Form guid you can grab in the URL when you have it up in the forms tool.
The end point you need to hit was the link I sent you. Here is the example of it. https://forms.hubspot.com/uploads/form/v2/:portal_id/:form_guid
I think you just need to figure out your portal ID and Form ID. Then you should be good when making that call to the endpoint.
Thank you for the reply. So to clarify I did not create my form through hubspot but just custom coded it on a website. That is where I am getting thrown off on the form guid. Do I need to create the form through hubspot to get that guid or how would I go about getting that without creating a form through hubspot?
@Tim_Garlick Yes you need to create a matching form in HubSpot. That way the info you send from your custom coded form has a “home” when you send the data to HubSpot.
OK that sounds good. Do I need to include the Javascript link? The reason why I am having a hard time is because the form I created has so much custom styling and javascript coded into it. Its not a typical form otherwise I assume this would me pretty straightforward.