web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

CRM 2015, Make a poll bilingual inside portal

(0) ShareShare
ReportReport
Posted on by 30

Hello,

I'm trying to add a poll to a web page of a crm portal. I managed to get it to work just fine in one language, but my portal supports 2 languages (English and French). Is there a way to make it bilingual?

Right now the way that I thought about was to add both sentences (ex: Do you like red? / Aimez-vous le rouge?) and then use JS to delete the part that is not needed when I load the page. The problem that I encountered is that when I use

       {% include 'poll' poll_name:"Test Poll 1" %} 

all that my jQuery sees is :

      <div class="poll" data-url="/_services/polls/10152feb-f33d-4cbd-997e-f7a336c3b8bf/65adeb71-a0b4-ea11-811c-005056b067c6" data-submit-url="/_services/polls/10152feb-f33d-4cbd-997e-f7a336c3b8bf/SubmitPoll?id=65adeb71-a0b4-ea11-811c-005056b067c6"></div>

It doesn't seem to see the html code that is added for the poll.

Does anybody know of a way to make it work?

Here is my code :

<div id="myInclude">
        {% include 'poll' poll_name:"Test Poll 1" %}
</div>
<script type="text/javascript">
        var htmlLang = $("html").attr("lang");

        $(document).ready( function() {
            var a = $("#myInclude").html();
          
            console.log(a);  
        });

Thank you
       

I have the same question (0)
  • Suggested answer
    OmarZaarour Profile Picture
    1,705 on at
    RE: CRM 2015, Make a poll bilingual inside portal

    Have you considered creating two polls, one in English and one in French? Then in the Poll Placement, create your own web template to render one of the polls based on the current website language. You can get the current language using this liquid command
    {% assign languagecode = website.selected_language.code %}

    Yes it is a bit more work to sum up the results later for both polls but it is worth it if it makes things cleaner.

    Here is a reference to how you can add a poll using liquid https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/customization-tools/polls/

  • dev2143 Profile Picture
    30 on at
    RE: CRM 2015, Make a poll bilingual inside portal

    Yes, I thought about that, but the only problem I have with it is that (correct me if I'm wrong) after voting each poll would only display the results for that specific poll (ex: The French poll only shows the votes for the users using french and The English poll only shows the results of the users using English. Votes can be aggregated later(that's not really a problem), but the users that are voting won't see the exact results, so I don't think that it would be a good solution.

  • OmarZaarour Profile Picture
    1,705 on at
    RE: CRM 2015, Make a poll bilingual inside portal

    You are right I missed that. OK back to your original issue. When I tested the same logic you had, I'm able to see the html of the poll, can you see the same in your dev tools?

    3073.pastedimage1592947439507v1.png

  • Verified answer
    OmarZaarour Profile Picture
    1,705 on at
    RE: CRM 2015, Make a poll bilingual inside portal

    I actually found out why you jquery doesn't find the html. The poll loads async after the document ready. One possible way is to wait for the poll to appear which I tested and worked below. I'm targeting the div that contains the html directly not its parent div. I borrowed the code that checks for element existence online.

    <div id="test">

          {% include 'poll' poll_name:"Yes or No Question" %}

    </div>

    <script type="text/javascript">

           var htmlLang = $("html").attr("lang");

           $(document).ready( function() {

               waitForElementToDisplay("div[data-name*='Yes or No Question']",100);        

           });

    function waitForElementToDisplay(selector, time) {

           if(document.querySelector(selector)!=null) {

               var a = $("div[data-name*='Yes or No Question']").html();

                 console.log(a);  

               return;

           }

           else {

               setTimeout(function() {

                   waitForElementToDisplay(selector, time);

               }, time);

           }

       }

           </script>

  • dev2143 Profile Picture
    30 on at
    RE: CRM 2015, Make a poll bilingual inside portal

    This solution worked. I can now access the elements with jQuery.

    Thank you very much!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 241

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 164 Super User 2025 Season 2

#3
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 153

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans