<?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: How to switch the submit button from an input element to a button element in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957186#M72608</link>
    <description>&lt;P&gt;Thanks for the tag&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/230185"&gt;@BérangèreL&lt;/a&gt;, unless I'm mistaken,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/741650"&gt;@DaveMyb&lt;/a&gt;&amp;nbsp;it sounds like you found a solution and you wanted to share it with others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2024 11:45:22 GMT</pubDate>
    <dc:creator>Jnix284</dc:creator>
    <dc:date>2024-04-09T11:45:22Z</dc:date>
    <item>
      <title>How to switch the submit button from an input element to a button element</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/956751#M72593</link>
      <description>&lt;P&gt;I recently was asked to add an arrow to our submit buttons for design purposes. We're embedding Hubspot forms into a Drupal website, and I struggled to find a way to do this using the default input element - psuedo-elements and inserted HTML don't work and trying to get something added outside of the input and then overlaying it with CSS seemed messy. I didn't see a similar post here about this, so I figured this might help other folks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the end, I used the following code to simply change the &amp;lt;input&amp;gt; to a &amp;lt;button&amp;gt; and it seems to work properly for me. I see submissions come in as expected, and the client is happy they have their arrow on the button.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Without removing the original "with-arrow" class, the script was re-targeting the elements and removing the button text for some reason.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're actually using Drupal, this code was used in the hubspot-form.html.twig template that the hubspot_forms module provides, but this should work for any system where you're embedding the forms yourself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;hbspt.forms.create({&lt;BR /&gt;  css: '',&lt;BR /&gt;  target: '#{{ target }}',&lt;BR /&gt;  portalId: '{{ portal_id }}',&lt;BR /&gt;  formId: '{{ form_id }}',&lt;BR /&gt;  submitButtonClass: 'btn btn-primary btn-sm with-arrow',&lt;BR /&gt;  onFormReady: function($form){&lt;BR /&gt;    // Swap the Submit input element for a button element so we can style it.&lt;BR /&gt;    // Get a reference to the input element&lt;BR /&gt;    var inputElements = document.getElementsByClassName('with-arrow');&lt;BR /&gt;    for ( var i = 0; i &amp;lt; inputElements.length; i++) {&lt;BR /&gt;&lt;BR /&gt;      // Create a new button element&lt;BR /&gt;      var buttonElement = document.createElement('button');&lt;BR /&gt;&lt;BR /&gt;      // Copy the relevant properties and attributes from the input to the button&lt;BR /&gt;      buttonElement.className = inputElements[i].className;&lt;BR /&gt;      // Change the arrow class so we don't re-target the button element, and&lt;BR /&gt;      // add the proper arrow class.&lt;BR /&gt;      buttonElement.classList.remove('with-arrow');&lt;BR /&gt;      buttonElement.classList.add('btn--with-arrow');&lt;BR /&gt;      buttonElement.type = inputElements[i].type;&lt;BR /&gt;      buttonElement.textContent = inputElements[i].value;&lt;BR /&gt;      buttonElement.onclick = inputElements[i].onclick;&lt;BR /&gt;&lt;BR /&gt;      // Replace the input element with the new button element&lt;BR /&gt;      inputElements[i].parentNode.replaceChild(buttonElement, inputElements[i]);&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 17:08:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/956751#M72593</guid>
      <dc:creator>DaveMyb</dc:creator>
      <dc:date>2024-04-08T17:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch the submit button from an input element to a button element</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957153#M72603</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/741650"&gt;@DaveMyb&lt;/a&gt;&lt;/SPAN&gt;, I hope that you are well!&lt;BR /&gt;&lt;BR /&gt;Thank you for asking the Community!&lt;BR /&gt;&lt;BR /&gt;I found for your the solution from &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt; on this post "&lt;A href="https://community.hubspot.com/t5/CMS-Development/Custom-Form-Button/td-p/669720" target="_blank"&gt;Custom Form Button&lt;/A&gt;" that might help you!&lt;BR /&gt;&lt;BR /&gt;Also, I'd be happy to put you in touch with our Top Experts and some of our Community Members for this: Hi &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt;, &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/73772"&gt;@Kevin-C&lt;/a&gt;&lt;/SPAN&gt;, &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/132135"&gt;@Summit90&lt;/a&gt;&lt;/SPAN&gt;, &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/24689"&gt;@Chandler&lt;/a&gt;, &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/19200"&gt;@TRooInbound&lt;/a&gt;&lt;/SPAN&gt; &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/82785"&gt;@warnerjm&lt;/a&gt;&lt;/SPAN&gt;, &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/363300"&gt;@Jnix284&lt;/a&gt;&lt;/SPAN&gt; and &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/133"&gt;@stefen&lt;/a&gt;&lt;/SPAN&gt; do you have suggestions to help &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/741650"&gt;@DaveMyb&lt;/a&gt;&lt;/SPAN&gt;, please?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot and have a wonderful day!&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Bérangère&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 10:27:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957153#M72603</guid>
      <dc:creator>BérangèreL</dc:creator>
      <dc:date>2024-04-09T10:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch the submit button from an input element to a button element</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957186#M72608</link>
      <description>&lt;P&gt;Thanks for the tag&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/230185"&gt;@BérangèreL&lt;/a&gt;, unless I'm mistaken,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/741650"&gt;@DaveMyb&lt;/a&gt;&amp;nbsp;it sounds like you found a solution and you wanted to share it with others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 11:45:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957186#M72608</guid>
      <dc:creator>Jnix284</dc:creator>
      <dc:date>2024-04-09T11:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch the submit button from an input element to a button element</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957210#M72609</link>
      <description>&lt;P&gt;Yep, that was the idea &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also wanted to give anyone else the chance to provide a simpler solution if I missed it e.g. there's a hidden setting in Hubspot that does this already, lol.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 12:15:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957210#M72609</guid>
      <dc:creator>DaveMyb</dc:creator>
      <dc:date>2024-04-09T12:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch the submit button from an input element to a button element</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957212#M72611</link>
      <description>&lt;P&gt;That is a useful post too, thanks! I was not really looking for a particular answer here, just sharing what I figured out in case someone else had the same issue. We're a bit limited with what we can easily do in terms of styling an &amp;lt;input type="submit"&amp;gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 12:16:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957212#M72611</guid>
      <dc:creator>DaveMyb</dc:creator>
      <dc:date>2024-04-09T12:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch the submit button from an input element to a button element</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957215#M72612</link>
      <description>&lt;P&gt;Awesome, sharing solutions is always appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2024 12:22:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/957215#M72612</guid>
      <dc:creator>Jnix284</dc:creator>
      <dc:date>2024-04-09T12:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to switch the submit button from an input element to a button element</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/979642#M73764</link>
      <description>&lt;P&gt;Hi &lt;SPAN&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/741650"&gt;@DaveMyb&lt;/a&gt;&lt;/SPAN&gt;, thank you so much for sharing the solution with the Community!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt;&lt;BR /&gt;Much appreciated!&lt;BR /&gt;&lt;BR /&gt;This will be really helpful to other Community Members, that's great!&lt;BR /&gt;&lt;BR /&gt;Sorry, I thought you were looking for a workaround &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;. Thanks &lt;SPAN&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/363300"&gt;@Jnix284&lt;/a&gt;&lt;/SPAN&gt; for the clarification!&lt;BR /&gt;&lt;BR /&gt;Have a lovely day!&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Bérangère&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 11:40:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/How-to-switch-the-submit-button-from-an-input-element-to-a/m-p/979642#M73764</guid>
      <dc:creator>BérangèreL</dc:creator>
      <dc:date>2024-05-21T11:40:25Z</dc:date>
    </item>
  </channel>
</rss>

