Home : Support : Frequently Asked Questions : FAQ Question #69

FAQ Question #69

» How do I add a poll to a journal entry?

In order to create a poll, you must have a Paid Account. For information on how to purchase a Paid Account, see http://www.livejournal.com/support/faqbrowse.bml?faqid=21; for information on the benefits of Paid Accounts, see http://www.livejournal.com/support/faqbrowse.bml?faqid=131.

Paid users can create polls in their own journals, as well as in any community journals (whether free or paid) that they have posting access to. Free users may only vote in polls. The one exception to this rule is if a free user is the maintainer of a paid community. In this situation, the free user is able to post polls only in the paid community that they maintain. This is the only situation in which a free user can create and post a poll.

Each LiveJournal user is allowed one vote in a poll. After you've voted in a poll, you can change your answer by clicking on the poll number, and then clicking the [ Fill out Poll ] link at the top of the page. Note that it is not possible to vote in a poll anonymously, which means that people without LiveJournal accounts cannot vote in polls. If you know someone who does not have a LiveJournal account but would like to vote in a poll, you may wish to encourage him or her to create a LiveJournal account. The FAQ http://www.livejournal.com/support/faqbrowse.bml?faqid=104 provides information on how to create a LiveJournal account.

There are two ways to create a poll. To create a poll easily, you can use the Poll Creator: http://www.livejournal.com/poll/create.bml. The poll creator will generate your poll's code for you, based on your specifications. It will allow you to preview your poll and create a journal entry containing the poll code. You can also simply copy and paste the code into a brand new journal entry. You can also create a poll by writing the code without the Poll Creator. This is explained under "CREATING A POLL BY WRITING THE CODE".


THINGS TO REMEMBER

You can only create a poll when you first create an entry. You cannot edit an old entry and include a new poll, or change an old poll when you edit the entry that contains it.

You cannot edit a poll once it has been made.

Polls may only be embedded into journal entries, not comments.

If you delete an entry that contains a poll, the poll will become inaccessible. You cannot create a new entry to restore an inaccessible poll; you must create a new poll. See http://www.livejournal.com/support/faqbrowse.bml?faqid=2 for information on deleting an entry.

Polls cannot contain most of the HTML tags that are allowed in journal entries and comments. Polls can contain the following HTML tags: <a>, <b>, <em>, <i>, <img>, <strong>, <u>. They can also contain the <lj user> tag for linking to other journals. (See http://www.livejournal.com/support/faqbrowse.bml?faqid=75 for more information about this LiveJournal-specific tag.)


CREATING A POLL BY WRITING THE CODE

If you would prefer not to use the Poll Creator, you can create a poll by writing the code yourself. If you would like to create a poll this way, or learn more about how the poll code works, read the rest of this FAQ.

                    *

When writing a journal entry, you can tell the LiveJournal servers that you want to start a poll by inserting the <lj-poll> tag. When the server parses this tag, it knows to display a poll based on the questions (<lj-pq>; "poll questions") and possible answers (<lj-pi>; "poll items") you provide.

When creating a poll, you must be very careful to provide a closing tag for every opening tag you insert, or the poll will not function correctly.

A very basic poll would look like this:

<lj-poll>

<lj-pq type="radio">
What is your name?
<lj-pi>Sir Lancelot of Camelot</lj-pi>
<lj-pi>Sir Robin of Camelot</lj-pi>
<lj-pi>Arthur, King of the Britons</lj-pi>
</lj-pq>

</lj-poll>

Some poll tags have attributes that you can use to provide more information. For example, a poll can be named by including the "name" attribute in the lj-poll tag, like this:

<lj-poll name="My First Poll">


TAGS AND THEIR ATTRIBUTES

<lj-poll> (beginning poll tag)

name="..."
    Labels the poll with a descriptive name

whovote="all,friends"
    Specifies who is allowed to vote in your poll. Options include any LiveJournal user (all), or just the people listed as friends (for personal journals) or members (for community journals) of the journal in which the poll is posted (friends). The default is all.

whoview="all,friends,none"
    Specifies who is allowed to see which user chose which answer for the poll. Options include any LiveJournal user (all), which is the default; just the people listed as friends (for personal journals) or members (for community journals) of the journal in which the poll is posted (friends); or no one except the journal owner of the journal in which the poll was posted (none). Any user who can see the entry that the poll resides in can see the aggregate statistical data (percentages and bar graphs).

Here is an example of a complex <lj-poll> tag:

    <lj-poll name="The Bridge of Death" whovote="friends" whoview="all">
    (This starts a poll named the "The Bridge of Death", where only the people on your friends list can vote. Anyone can see the raw data.)


<lj-pq> (poll question)

type="check,drop,radio,scale,text"

type="radio"
      Each item listed as a possible answer will have a radio button next to it, which means that people can only select one possible answer. At least one <lj-pi>possible answer</lj-pi> must be specified for each "radio" question.

type="check"
      Each item listed as a possible answer will have a check box next to it, which means that multiple choices may be selected. At least one <lj-pi>possible answer</lj-pi> must be specified for each "check" question.

type="drop"
      Each item listed as a possible answer will be displayed in a drop-down selection box, so that only one answer can be chosen. At least one <lj-pi>possible answer</lj-pi> must be specified for each "drop" question.

type="text"
      Displays a box that allows a person to freely type in a string of text as their answer. When a text input question is declared, there are no possible choices to be displayed (<lj-pi>).
      If a question is of type text, two additional attributes are possible, "size" and "maxlength". Example, size="30" will display a 30 character wide input box, while maxlength="50" will limit the voters' answers to 50 characters each.
      The limit for the "size" is 100. The limit for "maxlength" is 255.

type="scale"
      Displays separate numeric options based on the information specified. Voters are typically expected to be ranking or rating something, based on a number scale given.
      If absolutely no attributes (discussed below) are specified, the poll will display a scale of choices from 1 to 10.
      If a question is of type scale, three additional attributes are possible: "from", "to", and "by", which define the range of the question. "from" is the beginning number, "to" is the finishing number (which must be greater than the "from"), and "by" is the number of units in between each choice; this value must be 1 or greater.
      For example, if you want to make one of your questions "How old is old?" and wanted to include choices between 40 - 100, but only want choices in increments of 5 (eg 40, 45, 50, etc), you would enter <lj-pq type="scale" from="40" to="100" by="5">.
      Scale type questions must be limited to 20 possible choices per question. For example, a scale from 1 to 100 by increments of 5 is permitted; a scale from 1 to 100 by increments of 1 is not.
      If you use the scale option, the LiveJournal server is able to compute interesting numerical statistics on the way people have voted, such as the median and the average.


THINGS TO REMEMBER WHEN WRITING POLL CODE

Each tag needs an appropriate closing tag.

Each <lj-pq> requires a "type" attribute.

The question text must follow immediately after the <lj-pq> tag.

<lj-pi> tags are for radio, check, and drop questions only. All possible answers are wrapped in <lj-pi> tags </lj-pi>. They are to be inserted after the question's text, but before the question's closing </lj-pq> tag.

Poll tags need to be nested correctly in order to work. For example, you must close each answer or question before you start a new one.

If you insert a line break inside a poll tag, it will not be automatically converted to an HTML line break (<br>), and the line break (<br>) and paragraph (<p>) tags are not allowed in polls.

Last Updated:
rho, 2004-07-31


Back to the parent FAQ category.
Back to the FAQ.
Back to the support area.
English • Español • Deutsch • Français • Русский • →