CMS Development

codenil
Participant

Using form to add rows in HubDB table

Résolue

Hi, this is my first post here. And I plan to create a HubDB table with each row containing details of new job openings from our HR department. And from that, I want to create a set of dynamic pages - one for the list of all jobs and the individual detail pages for each job opening.  From the docs and guide articles, I know how to do it. But my idea is to create a password-protected page for the HR personnel on which there will be a form to add new job posts (with fields reflecting data in each column of a new HubDB row). For this part, I am not finding any resource describing the process of storing the form submission data in my HubDB table. Please help with an example. Thanks in advance.

0 Votes
1 Solution acceptée
Anton
Solution
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

Using form to add rows in HubDB table

Résolue

Hi @codenil

you can create a custom module with a modified form embed code like this one

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
  hbspt.forms.create({
    region: "na1",
    portalId: "{{ hub_id }}",
    formId: "{{ module.form_field.form_id }}",
			{# all further modifications come here #}
  });
</script>

 

add a form function to it (in this example I did not modify the name) and trigger the HubDB API on an "onFormSubmitted" event

 

hope this helps. 

 

btw - you can create multilevel dynamic pages(listing, detail...) with HubDB

 

best,

Anton

Anton Bujanowski Signature

Voir la solution dans l'envoi d'origine

2 Réponses
codenil
Participant

Using form to add rows in HubDB table

Résolue

@Anton Thanks so much for the above details. I am a beginner in HubSpot, so I am asking this. I went to HubDB API docs, when I test an API, I do get the results on the API Docs section. But as I try to paste the Node code (that worked in test area) in my HubSpot Module, I get an error saying, "Uncaught ReferenceError: require is not defined"

 

Does this mean, I can not use the API call from the HubSpot module? Please help.

0 Votes
Anton
Solution
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

Using form to add rows in HubDB table

Résolue

Hi @codenil

you can create a custom module with a modified form embed code like this one

<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>
<script>
  hbspt.forms.create({
    region: "na1",
    portalId: "{{ hub_id }}",
    formId: "{{ module.form_field.form_id }}",
			{# all further modifications come here #}
  });
</script>

 

add a form function to it (in this example I did not modify the name) and trigger the HubDB API on an "onFormSubmitted" event

 

hope this helps. 

 

btw - you can create multilevel dynamic pages(listing, detail...) with HubDB

 

best,

Anton

Anton Bujanowski Signature