<?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: Choice generated dynamically does not support multiple in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Choice-generated-dynamically-does-not-support-multiple/m-p/1043132#M40707</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/828901"&gt;@ASpahiu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We’ve shared some code with you, including different conditions. Please check it once—hopefully, it will work. If not, kindly share the page with us, and we’ll take a look and provide guidance. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Update code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% choice "multi_choice_field" label="multiple choice" display="checkbox" &amp;lt;!-- Change display to checkbox for multiple options --&amp;gt; choices=[ [ "option-1", "Option 1" ], [ "option-2", "Option 2" ] ] multiple=true %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you want to generate options dynamically, you can do so by using HubL loops. Here's an example of how you can generate choices dynamically:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set options = [ { "value": "option-1", "label": "Option 1" }, { "value": "option-2", "label": "Option 2" }, { "value": "option-3", "label": "Option 3" } ] %} {% choice "multi_choice_field" label="multiple choice" display="checkbox" multiple=true choices=options %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you prefer to keep the dropdown style but allow multiple selections, you’ll need to manually adjust the HTML using the select tag and enable multiple selections like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;select name="multi_choice_field" multiple&amp;gt; {% for option in options %} &amp;lt;option value="{{ option.value }}"&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt; {% endfor %} &amp;lt;/select&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-sheets-root="1"&gt;I hope this will help you out. Please mark it as &lt;STRONG&gt;Solution Accepted and upvote&lt;/STRONG&gt; to help another Community member.&lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2024 11:11:40 GMT</pubDate>
    <dc:creator>GRajput</dc:creator>
    <dc:date>2024-09-19T11:11:40Z</dc:date>
    <item>
      <title>Choice generated dynamically does not support multiple</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Choice-generated-dynamically-does-not-support-multiple/m-p/1043026#M40704</link>
      <description>&lt;P&gt;I am trying to create a choice module, that has some options generated dinamically. After creating it, I want to have the possibility to multiple select choices from this, similarly how a choice field works on modules when "Allow selection of multiple options" is activated.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;Code:&amp;nbsp;&lt;BR /&gt;{% choice "multi_choice_field" label="multiple choice" display="select" choices=[ [ "option-1", "Option 1" ], [ "option-2", "Option 2" ] ] multiple=true %}&lt;BR /&gt;Is this possible?&amp;nbsp;&lt;BR /&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 07:23:59 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Choice-generated-dynamically-does-not-support-multiple/m-p/1043026#M40704</guid>
      <dc:creator>ASpahiu</dc:creator>
      <dc:date>2024-09-19T07:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Choice generated dynamically does not support multiple</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Choice-generated-dynamically-does-not-support-multiple/m-p/1043132#M40707</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/828901"&gt;@ASpahiu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We’ve shared some code with you, including different conditions. Please check it once—hopefully, it will work. If not, kindly share the page with us, and we’ll take a look and provide guidance. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Update code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% choice "multi_choice_field" label="multiple choice" display="checkbox" &amp;lt;!-- Change display to checkbox for multiple options --&amp;gt; choices=[ [ "option-1", "Option 1" ], [ "option-2", "Option 2" ] ] multiple=true %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you want to generate options dynamically, you can do so by using HubL loops. Here's an example of how you can generate choices dynamically:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set options = [ { "value": "option-1", "label": "Option 1" }, { "value": "option-2", "label": "Option 2" }, { "value": "option-3", "label": "Option 3" } ] %} {% choice "multi_choice_field" label="multiple choice" display="checkbox" multiple=true choices=options %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you prefer to keep the dropdown style but allow multiple selections, you’ll need to manually adjust the HTML using the select tag and enable multiple selections like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;select name="multi_choice_field" multiple&amp;gt; {% for option in options %} &amp;lt;option value="{{ option.value }}"&amp;gt;{{ option.label }}&amp;lt;/option&amp;gt; {% endfor %} &amp;lt;/select&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-sheets-root="1"&gt;I hope this will help you out. Please mark it as &lt;STRONG&gt;Solution Accepted and upvote&lt;/STRONG&gt; to help another Community member.&lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 11:11:40 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Choice-generated-dynamically-does-not-support-multiple/m-p/1043132#M40707</guid>
      <dc:creator>GRajput</dc:creator>
      <dc:date>2024-09-19T11:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Choice generated dynamically does not support multiple</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Choice-generated-dynamically-does-not-support-multiple/m-p/1043137#M40708</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/346639"&gt;@GRajput&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks for following up.&amp;nbsp;&lt;BR /&gt;I have tried this approach earlier and it doesn't work.&amp;nbsp;&lt;BR /&gt;I do not think that what I am trying to do is possible, after confronting official &lt;A href="https://developers.hubspot.com/docs/cms/hubl/tags" target="_blank" rel="noopener"&gt;Hubspot Documentation.&lt;/A&gt;&lt;BR /&gt;On the choice tag, the only parameters that could be added are &lt;STRONG&gt;value&lt;/STRONG&gt; and &lt;STRONG&gt;choices, &lt;/STRONG&gt;and this means that this dynamically generated choice module doesn't behave like the usual choice field on modules.&amp;nbsp;&lt;BR /&gt;Thanks for reaching out&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 11:26:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Choice-generated-dynamically-does-not-support-multiple/m-p/1043137#M40708</guid>
      <dc:creator>ASpahiu</dc:creator>
      <dc:date>2024-09-19T11:26:44Z</dc:date>
    </item>
  </channel>
</rss>

