CMS Development

EricaFontimedia
Contributor | Elite Partner
Contributor | Elite Partner

Adding ID to form in a template

SOLVE

Hi everybody,

I have an issue that you probably know:
I need to add an ID to a form in the template of the page or in the module.
With the old editor it was really simple, but how can I do it now?
I've tried to inserted it in the code but id doesn't appear in the code of the page.


Thank you for your help!

 

Anther question:

the HubSpot support advice me to use the Slack group, but I see there are a lot of questions and no answers. How does it work, so?

0 Upvotes
1 Accepted solution
EricaFontimedia
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Adding ID to form in a template

SOLVE

Thank you erod!

I've solved using the current ID of the form.

It's not a template edit but I was wasting to much time on this task.

Next time I'll try your solution!

 

Thanks!

View solution in original post

0 Upvotes
5 Replies 5
EricaFontimedia
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Adding ID to form in a template

SOLVE

Thank you erod!

I've solved using the current ID of the form.

It's not a template edit but I was wasting to much time on this task.

Next time I'll try your solution!

 

Thanks!

0 Upvotes
EricaFontimedia
Contributor | Elite Partner
Contributor | Elite Partner

Adding ID to form in a template

SOLVE

Hi Erod,

thank you for your answer!

My issue is not about adding a form but adding an ID, for example #form

This is because I have to create a button that link to the form section of the page in this way: www.page.com/#form

0 Upvotes
erod
Contributor

Adding ID to form in a template

SOLVE

Hi @EricaFontimedia

 

Oooooh, got it. You're talking about an inline ID (i.e. <div id="form"></div>) to create an anchor link and not the actual form ID (unique identifier).

 

Try wrapping the form code in a div with the form ID:

<div id="form">
{# form markup here #}
</div>

 

This should work however it might depend on the way you have your form set up. Give it a try and if it doesn't work, provide a link or screenshot of your form. 

 

Cheers, 

Edgar

dennisedson
HubSpot Product Team
HubSpot Product Team

Adding ID to form in a template

SOLVE

@EricaFontimedia ,

Could you post the code for your module?  When you insert a form it will automatically be given an id.  What you probably want  to do is wrap the form in a div with an ID.  Remember, an ID should only be used once on a page so you might want to make the ID a text field in your module so you can create the  ID when building the page itself. 

0 Upvotes
erod
Contributor

Adding ID to form in a template

SOLVE

Hi @EricaFontimedia , 

 

I think I understand your prpoblem but let me know if I'm way off base. Have you tried adding a Form Field from the Fields section on the right hand side of your module? If you do, you'll be able to select the form you want. Once you select the form, you'll have to paste either the snippet or value (depending on how your code set up) in your module—most likely replacing the code you're currently using. I've pasted some screenshots below. Hopefully they help. 

 

Screen Shot 2021-10-18 at 10.19.29 AM.png

 

 

 

Screen Shot 2021-10-18 at 10.23.43 AM.png