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 » one month 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 » one month 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 » one month 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 » one month 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 » one month 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 » one month 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

How to install code on Wordpress site
  • 1 reply
Hi, I'm hoping someone can help me with this quickly as I need to...

search in responses of surveys
  • 3 replies
Hi Maverick,  Am I doing something wrong?  Search in...

Images not showing
  • 3 replies
Problem 1 We are looking to set up a question where there is a...

Problem giving "Thank You"
  • 10 replies
Is there a setting somewhere to manage this?  I often am...

Track hits are deleted
  • 2 replies
Hello, when track content in backend is updated after "save"/"save...