CMS Development

RomanGruit
Stratege/Strategin

Get form fields name through Hubl

lösung

Hey. Is there a way to get a form fields through Hubl where the form is module field by itself? For example, {{ module.form_field.form_id }} gives us form id. I'm looking for something like. 

{{ module.form_field.fields[1].name }}

 

 

0 Upvotes
1 Akzeptierte Lösung
lscanlan
Lösung
HubSpot-Alumnus/Alumna
HubSpot-Alumnus/Alumna

Get form fields name through Hubl

lösung

Hi @RomanGruit.

 

I've been playing around with this and it doesn't look like a module's form field's fields are exposed in any way through HubL. You can actually see everything that's exposed by using the |pprint filter: https://designers.hubspot.com/docs/hubl/hubl-supported-filters#pprint. So for example right in the module's HTML + HubL field you could just print out all the module data with this: {{ module|pprint }} . Or if you wanted to see just a module field's data, you could print that into your HTML with something like this: {{ module.form_field|pprint }} . I also usually will add some text to indicate what specifically I'm printing out, like:

 

<p>module.form_field|pprint: {{ module.form_field|pprint }}</p>

What is it that you're trying to do with the module's form field's fields? Maybe there's some other way to accomplish it.

 

Leland Scanlan

HubSpot Developer Support

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
2 Antworten
lscanlan
Lösung
HubSpot-Alumnus/Alumna
HubSpot-Alumnus/Alumna

Get form fields name through Hubl

lösung

Hi @RomanGruit.

 

I've been playing around with this and it doesn't look like a module's form field's fields are exposed in any way through HubL. You can actually see everything that's exposed by using the |pprint filter: https://designers.hubspot.com/docs/hubl/hubl-supported-filters#pprint. So for example right in the module's HTML + HubL field you could just print out all the module data with this: {{ module|pprint }} . Or if you wanted to see just a module field's data, you could print that into your HTML with something like this: {{ module.form_field|pprint }} . I also usually will add some text to indicate what specifically I'm printing out, like:

 

<p>module.form_field|pprint: {{ module.form_field|pprint }}</p>

What is it that you're trying to do with the module's form field's fields? Maybe there's some other way to accomplish it.

 

Leland Scanlan

HubSpot Developer Support
0 Upvotes
RomanGruit
Stratege/Strategin

Get form fields name through Hubl

lösung

Hi @lscanlan ! Thank you for your prompt response. I'm writing a custom form with submitting it through form API. The problem is that we can't get to know what fields particular form has on a server level.🤷🏻‍♂️

0 Upvotes