CMS Development

theAndreyK
Contributor | Partner
Contributor | Partner

How can I insert HTML into a HUBDB table column?

Hello, 

 

For one of our projects, I need to be able to insert raw HTML inside of a HUBDB cell. When I use the "rich text" option it wraps everything inside of a <p> tag. Do I have any options? 

 

Would using the REST API work? 

 

Best,
Andrey

0 Upvotes
3 Replies 3
kyl3
Contributor

How can I insert HTML into a HUBDB table column?

No HTML insertion into hubDB is working for me. I think Hubspot has even blocked parseHTML in jquery. Very limiting and disappointing. Forces you to combine the db and dnd or modules and lose track of where things are.

0 Upvotes
JasonRosa
HubSpot Employee
HubSpot Employee

How can I insert HTML into a HUBDB table column?

Hey, @theAndreyK you could try using a replace HubL filter when outputting the row in your code. So something like this: 

 

{{ dynamic_page_hubdb_row.html|replace('<p>','')|replace('</p>','') }}

There looks to be a third parameter you might be able to use with the replace filter to target a specific count (e.g. the first <p> that is outputted if you have other paragraph tags in your code). 

0 Upvotes
theAndreyK
Contributor | Partner
Contributor | Partner

How can I insert HTML into a HUBDB table column?

Thanks for the reply Jason. It looks like if I use a regular text field and insert HTML, it will show up as HTML and only add a <div> around the content. Even better, if I use a sectioning tag like <article> it won't even add the <div>. 

 

I'm going to need to use this right now for a project so I'll post back here to let everyone know if that ends up working or not.