<?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 get data for the next and previous index in the for loop in hubl for setting conditions? in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/How-to-get-data-for-the-next-and-previous-index-in-the-for-loop/m-p/723013#M31595</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/367528"&gt;@FurqanAli&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;is that something like so you want to perform?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script&amp;gt;
    function showVal(newVal) {
        if (newVal &amp;lt;= {{ module.free_slab_limit }}) {
            jQuery(".pricing-columns__item.featured.alternated p.pricing-columns__price").text("{{ free_text.freeText }}");
            jQuery(".workspace_members span").text(newVal);
        }
        {% for item in module.step_fields %}
            {% if loop.first %}
                else if (newVal &amp;gt;= {{ item.step_value }} &amp;amp;&amp;amp; ({{ module.step_fields[loop.index0 + 1].step_value }})) { // only next value
                    jQuery(".workspace_members span").text("{{ item.step_text }}");
                }
            {% elif loop.last %}
                else if (newVal &amp;gt;= {{ item.step_value }} &amp;amp;&amp;amp; ({{ module.step_fields[loop.index0 - 1].step_value }})) { // only prev value
                    jQuery(".workspace_members span").text("{{ item.step_text }}");
                }
            {% else %}
                else if (newVal &amp;gt;= {{ item.step_value }} &amp;amp;&amp;amp; ({{ module.step_fields[loop.index0 - 1].step_value }} &amp;amp;&amp;amp; {{ module.step_fields[loop.index0 + 1].step_value }})) { // prev &amp;amp; next value
                    jQuery(".workspace_members span").text("{{ item.step_text }}");
                }
            {% endif %}
        {% endfor %}
        else {
            jQuery(".pricing-columns__item.featured.alternated p.pricing-columns__price").text("$" + (newVal * {{ module.per_user_cost }}));
            jQuery(".workspace_members span").text(newVal);
        }
    }
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Matthieu&lt;/P&gt;&lt;P&gt;matthieu.berard@markentive.com&lt;/P&gt;</description>
    <pubDate>Fri, 25 Nov 2022 10:26:37 GMT</pubDate>
    <dc:creator>MBERARD</dc:creator>
    <dc:date>2022-11-25T10:26:37Z</dc:date>
    <item>
      <title>How to get data for the next and previous index in the for loop in hubl for setting conditions?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-get-data-for-the-next-and-previous-index-in-the-for-loop/m-p/722821#M31585</link>
      <description>&lt;P&gt;Hi there,&lt;BR /&gt;&lt;BR /&gt;I'm trying to set conditions in Hubl under for loop for the repeated fields.&amp;nbsp; You can see my code below under the script tag where I'm using different values:&lt;BR /&gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;function showVal(newVal){&lt;BR /&gt;if(newVal &amp;lt;= {{ module.free_slab_limit }}){&lt;BR /&gt;jQuery(".pricing-columns__item.featured.alternated p.pricing-columns__price").text("{{free_text.freeText}}");&lt;BR /&gt;jQuery(".workspace_members span").text(newVal);&lt;BR /&gt;}&lt;BR /&gt;{% for item in module.step_fields %}&lt;BR /&gt;else if( newVal&amp;gt;= {{item.step_value}} &amp;amp;&amp;amp; (Here I need to use the condition for next and previous index)){&lt;BR /&gt;jQuery(".workspace_members span").text("{{ item.step_text }}");&lt;BR /&gt;}&lt;BR /&gt;{% endfor %}&lt;BR /&gt;else{&lt;BR /&gt;jQuery(".pricing-columns__item.featured.alternated p.pricing-columns__price").text("$" + (newVal*{{ module.per_user_cost }}));&lt;BR /&gt;jQuery(".workspace_members span").text(newVal);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for the help as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 20:51:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-get-data-for-the-next-and-previous-index-in-the-for-loop/m-p/722821#M31585</guid>
      <dc:creator>FurqanAli</dc:creator>
      <dc:date>2022-11-24T20:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data for the next and previous index in the for loop in hubl for setting conditions?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-get-data-for-the-next-and-previous-index-in-the-for-loop/m-p/723013#M31595</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/367528"&gt;@FurqanAli&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;is that something like so you want to perform?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script&amp;gt;
    function showVal(newVal) {
        if (newVal &amp;lt;= {{ module.free_slab_limit }}) {
            jQuery(".pricing-columns__item.featured.alternated p.pricing-columns__price").text("{{ free_text.freeText }}");
            jQuery(".workspace_members span").text(newVal);
        }
        {% for item in module.step_fields %}
            {% if loop.first %}
                else if (newVal &amp;gt;= {{ item.step_value }} &amp;amp;&amp;amp; ({{ module.step_fields[loop.index0 + 1].step_value }})) { // only next value
                    jQuery(".workspace_members span").text("{{ item.step_text }}");
                }
            {% elif loop.last %}
                else if (newVal &amp;gt;= {{ item.step_value }} &amp;amp;&amp;amp; ({{ module.step_fields[loop.index0 - 1].step_value }})) { // only prev value
                    jQuery(".workspace_members span").text("{{ item.step_text }}");
                }
            {% else %}
                else if (newVal &amp;gt;= {{ item.step_value }} &amp;amp;&amp;amp; ({{ module.step_fields[loop.index0 - 1].step_value }} &amp;amp;&amp;amp; {{ module.step_fields[loop.index0 + 1].step_value }})) { // prev &amp;amp; next value
                    jQuery(".workspace_members span").text("{{ item.step_text }}");
                }
            {% endif %}
        {% endfor %}
        else {
            jQuery(".pricing-columns__item.featured.alternated p.pricing-columns__price").text("$" + (newVal * {{ module.per_user_cost }}));
            jQuery(".workspace_members span").text(newVal);
        }
    }
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Matthieu&lt;/P&gt;&lt;P&gt;matthieu.berard@markentive.com&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2022 10:26:37 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-get-data-for-the-next-and-previous-index-in-the-for-loop/m-p/723013#M31595</guid>
      <dc:creator>MBERARD</dc:creator>
      <dc:date>2022-11-25T10:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data for the next and previous index in the for loop in hubl for setting conditions?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-get-data-for-the-next-and-previous-index-in-the-for-loop/m-p/723047#M31598</link>
      <description>&lt;P&gt;Thanks for clarifying many things in your code related to indexes and setting conditions under the loop; this is something I was looking for.&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/341938"&gt;@MBERARD&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2022 12:24:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-get-data-for-the-next-and-previous-index-in-the-for-loop/m-p/723047#M31598</guid>
      <dc:creator>FurqanAli</dc:creator>
      <dc:date>2022-11-25T12:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data for the next and previous index in the for loop in hubl for setting conditions?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-get-data-for-the-next-and-previous-index-in-the-for-loop/m-p/723076#M31600</link>
      <description>&lt;P&gt;Happy to helped&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2022 13:55:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-get-data-for-the-next-and-previous-index-in-the-for-loop/m-p/723076#M31600</guid>
      <dc:creator>MBERARD</dc:creator>
      <dc:date>2022-11-25T13:55:50Z</dc:date>
    </item>
  </channel>
</rss>

