<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Autogrow Multi-Line Form Field to its Content in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Autogrow-Multi-Line-Form-Field-to-its-Content/m-p/893457#M37118</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/166875"&gt;@rs13930&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for reaching out! Let's invite some of our community members to the conversation — hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/192704"&gt;@ankitparmar09&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/114957"&gt;@Syeda_Fatima&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/341938"&gt;@MBERARD&lt;/a&gt;&amp;nbsp;have you styled any forms using this method recently? Or do you have any insight into other ways&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/166875"&gt;@rs13930&lt;/a&gt;&amp;nbsp;might tackle their project?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Jaycee&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2023 20:26:31 GMT</pubDate>
    <dc:creator>Jaycee_Lewis</dc:creator>
    <dc:date>2023-12-13T20:26:31Z</dc:date>
    <item>
      <title>Autogrow Multi-Line Form Field to its Content</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Autogrow-Multi-Line-Form-Field-to-its-Content/m-p/892613#M37073</link>
      <description>&lt;P data-unlink="true"&gt;&lt;SPAN&gt;Hi! I'm pretty new to using dev tools (and coding in general) I'm trying to style a form so that every &amp;lt;textarea&amp;gt; (multi-line form field) in our theme autogrows to its content. I did find&amp;nbsp;this resource (&lt;A href="https://css-tricks.com/the-cleanest-trick-for-autogrowing-textareas/" target="_blank"&gt;https://css-tricks.com/the-cleanest-trick-for-autogrowing-textareas/&lt;/A&gt;)&lt;SPAN&gt;&amp;nbsp;explaining how to do this with a custom form and my team is using a custom form module, but how exactly would I apply this? Is this possible with a HubSpot form?&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I've attached the module code and fields but can provide more info if anyone has any ideas.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 15:48:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Autogrow-Multi-Line-Form-Field-to-its-Content/m-p/892613#M37073</guid>
      <dc:creator>rs13930</dc:creator>
      <dc:date>2023-12-12T15:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Autogrow Multi-Line Form Field to its Content</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Autogrow-Multi-Line-Form-Field-to-its-Content/m-p/893457#M37118</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/166875"&gt;@rs13930&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for reaching out! Let's invite some of our community members to the conversation — hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/192704"&gt;@ankitparmar09&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/114957"&gt;@Syeda_Fatima&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/341938"&gt;@MBERARD&lt;/a&gt;&amp;nbsp;have you styled any forms using this method recently? Or do you have any insight into other ways&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/166875"&gt;@rs13930&lt;/a&gt;&amp;nbsp;might tackle their project?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Jaycee&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 20:26:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Autogrow-Multi-Line-Form-Field-to-its-Content/m-p/893457#M37118</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-12-13T20:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Autogrow Multi-Line Form Field to its Content</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Autogrow-Multi-Line-Form-Field-to-its-Content/m-p/893732#M37126</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/166875"&gt;@rs13930&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you add the following code to your module:&lt;/P&gt;
&lt;P&gt;- in your style tag:&lt;/P&gt;
&lt;LI-CODE lang="css"&gt;.input--grower {
	display: grid;
}
.input--grower::after {
	content: attr(data-replicated-value) " ";
	white-space: pre-wrap;
	visibility: hidden;
}
.input--grower &amp;gt; .hs-fieldtype-textarea.hs-input {
	resize: none;
	overflow: hidden;
}
.input--grower &amp;gt; .hs-fieldtype-textarea.hs-input,
.input--grower::after {
	border: 1px solid black;
	padding: 0.5rem;
	font: inherit;
	grid-area: 1 / 1 / 2 / 2;
}&lt;/LI-CODE&gt;
&lt;P&gt;- after the closing style tag add the following code:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% require_js %}
	&amp;lt;script&amp;gt;
		window.addEventListener('message', (event) =&amp;gt; {
			if (event.data.type === 'hsFormCallback' &amp;amp;&amp;amp; event.data.eventName === 'onFormReady') {
				console.log('form is ready');

				const currentForm = document.querySelector(`form[data-form-id="${event.data.id}"]`);

				if (currentForm) {
					const textareas = currentForm.querySelectorAll('textarea');
					if (textareas.length &amp;gt; 0) {
						textareas.forEach((textarea) =&amp;gt; {
						const currentInput = textarea.closest('.input');
						if (currentInput) {
							currentInput.classList.add('input--grower');
							textarea.addEventListener("input", () =&amp;gt; {
								currentInput.dataset.replicatedValue = textarea.value;
							});
							}
						});
					}

				}
				
			}
		})
	&amp;lt;/script&amp;gt;
{% end_require_js %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;The script listen to a given event sent by hubspot form. Once the form is ready the function will start and your textearea will be updated.&lt;/P&gt;
&lt;P&gt;You may need to adapt the style of the textarea and the fake element that show the text.&lt;/P&gt;
&lt;P&gt;Let me know if you have trouble or questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Matthieu&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 09:53:39 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Autogrow-Multi-Line-Form-Field-to-its-Content/m-p/893732#M37126</guid>
      <dc:creator>MBERARD</dc:creator>
      <dc:date>2023-12-14T09:53:39Z</dc:date>
    </item>
  </channel>
</rss>

