Dear all,

I would like to use HTML markup for layout and style purposes in the answers of a community polls poll. But any HTML tags I enter seem to get filtered. Is there any way (other than DOM manipulation with JavaScript) so that I can add custom HTML markup to my poll answers? Alternatively, is there documentation on creating a layout override for the frontend output of an answer?

Thank you

Kind regards
Thomas

Like it on Facebook, Tweet it or share this topic on other bookmarking websites.
  • Re: Use HTML markup in poll answers

    by » 5 months ago


     

    The poll answers do not allow custom HTML. However, you can enter the HTML content in the poll description using your Joomla editor.
     
    Layout overrides

    Follow me on twitter: https://twitter.com/corejoomla
    If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory.
    Sociable | Surveys | 
    CjForum | Polls | Answers | Quizzes | Quotes | GPS ToolsCjFit | CjBlog


    Thank you said by: forrestkirby

  • Re: Use HTML markup in poll answers

    by » 5 months ago


    Hi maverick,

    thank you for your answer. Unfortunately, I already tried the poll description field, but will not allow me to add custom HTML markup per answer, only per poll. So the bottom line for me is, that it’s not possible.

    Kind regards

    Thomas


  • Re: Use HTML markup in poll answers

    by » 5 months ago


    That's possible, although with small code modifications. If you can wait, I will incorporate into next version. Otherwise please follow the below steps.

    1. edit administrator/components/com_communitypolls/models/forms/poll.xml and find below code at line 6

    <field name="poll-final-answers" type="hidden"/>
    <field name="poll-final-columns" type="hidden"/>

    Change it to

    <field name="poll-final-answers" type="hidden" filter="JComponentHelper::filterText"/>
    <field name="poll-final-columns" type="hidden" filter="JComponentHelper::filterText"/>

    This will allow you to enter HTML codes into the answer boxes. Now you need to allow showing this HTML on front-end. 

    Edit components/com_communitypolls/layouts/YOURLAYOUTNAME/poll/answers.php, find and replace all occurrences  of 

    $this->escape($answer->title)

    with

    $answer->title

    Similarly, replace them in components/com_communitypolls/layouts/YOURLAYOUTNAME/poll/results/sbar.php as well.


    Follow me on twitter: https://twitter.com/corejoomla
    If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory.
    Sociable | Surveys | 
    CjForum | Polls | Answers | Quizzes | Quotes | GPS ToolsCjFit | CjBlog


    Thank you said by: forrestkirby

  • Re: Use HTML markup in poll answers

    by » 5 months ago


    If you can wait, I will incorporate into next version.

    That’d be great, thank you very much! :)

    Otherwise please follow the below steps.

    This works perfectly, exactly what I needed. Thank you very much!

     

    Edit: Unfortunately, the interim fix seems to cause a syntax error which impacts the voting functionality.

    Uncaught SyntaxError: Unexpected token < in JSON at position 956
        at JSON.parse (<anonymous>)
        at Function.d.parseJSON (jquery.min.js?870178a31c3ec7e061522d47ebe46619:2)
        at Function.a.parseJSON (jquery-migrate.min.js?870178a31c3ec7e061522d47ebe46619:2)
        at Object.PollsFactory.loadModernChart (cj.polls.min.js?t=1595951022:317)
        at HTMLDivElement.<anonymous> (cj.polls.min.js?t=1595951022:626)
        at Function.each (jquery.min.js?870178a31c3ec7e061522d47ebe46619:2)
        at a.fn.init.each (jquery.min.js?870178a31c3ec7e061522d47ebe46619:2)
        at Object.PollsFactory.init_poll_view (cj.polls.min.js?t=1595951022:542)
        at HTMLDocument.<anonymous> (cj.polls.min.js?t=1595951022:873)
        at u (jquery.min.js?870178a31c3ec7e061522d47ebe46619:2)

  • Re: Use HTML markup in poll answers

    by » 5 months ago


    I could not reproduce this issue, maybe some code change is missing in your code. Make sure you have closed the HTML tags correctly. I will release the new version shortly, please update it and check.


    Follow me on twitter: https://twitter.com/corejoomla
    If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory.
    Sociable | Surveys | 
    CjForum | Polls | Answers | Quizzes | Quotes | GPS ToolsCjFit | CjBlog


    Thank you said by: forrestkirby

  • Re: Use HTML markup in poll answers

    by » 5 months ago


    Edit: Sorry, I first posted a reply for another topic.

    Thanks for the answer, I’ll try again with the update then.


You do not have permissions to reply to this topic.

Powered by CjForum

Trending Topics

Smart Search plugin for CJF?
  • 4 replies
Looking to remove the legacy Search from my joomla site...

Multiple image selections not showing in consolidated report
  • 3 replies
I have set min 3 answers and max 3 answers in a multiple image...

Strange behavior when trying to do the same survey from two sides at the same time
  • 8 replies
Hello, I'm trying to do an anonymous survey, but I found a strange...

Survey Results show when I take the same survey again
  • 5 replies
Hi, I have an issue that when I take the same survey for a second...

Registration Page
  • 1 reply
Hi,   my Config: Joomla 3.9.23, Sociable 1.1.0, Template...