Fieldtype, Module

Archived
Forum
(read-only)


For official support, visit the official support site »

VWM Polls

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Victor Michnowicz

     

Only one poll option

Support Request

cheezwiz
cheezwiz

How do you get more than one poll option to be visible for the entry?

The Polls video shows the developer rapidly entering multiple choices (favorite colors) but does not show what he did to enable more than one option to appear.

My EE with the polls module installed shows only one option. Pressing Tab or Enter does not cause more options to appear.

Victor Michnowicz
# 1
Developer
Victor Michnowicz

When the text input has focus and you hit the enter key it should add that poll option (as long as the poll option has a value). Alternatively, you can click the green plus, “+”, button. If this is not working I would recommend opening up the JavaScript console in Firebug or Chrome Inspector and see if any errors are being reported.

What version of EE and PHP are you running?

cheezwiz
# 2
cheezwiz

I did not install the VMW Polls archive contents in the right locations on the site. I deleted it all from the site and will start over.

Assuming I can get that working, how do I use the {poll} field? It appears that it is not similar to, say, {body} where I can just include that field in my template and the entries tag will render what is in the body for that entry. I don’t see where your example uses the simple {poll} field.

Your example involves a completely new channel and a template devoted to the poll. What I am trying to do is use the poll within entries in a template group and channel that already exist.

It looks like my first job will be to insert code to determine if an entry contains a poll, and if so, to display the contents of the poll. And it also looks like I will have to snip code out of your example template and put it in a snippet and call that snippet. Is that a good way to go, or do you recommend a different procedure?

Thank you Victor.

Victor Michnowicz
# 3
Developer
Victor Michnowicz

The confusion may be due the fact that the ID of the VWM Polls fieldtype in my example code is not “poll”, and instead it is “poll_1”.

Adding a poll to an existing channel is almost exactly the same as creating a new channel just for polls. The only difference is that you do not have to create a new channel or templates. All the other steps are the same.

Assume you have the channel “my_awesome_channel” and the channel field group “My Awesome Channel Field Group” assigned to “my_awesome_channel”. In “My Awesome Channel Field Group” you must create a new channel field, for the sake of example, “my_awesome_poll” with the type of VWM Polls.

Then when you go to the publish page for “my_awesome_channel” you will be able to enter your poll data.

Assuming you only want some entries to have a poll you should be able to check with some code like this:

{if my_awesome_poll}
[insert your poll code]
{
/if} 

Then in my example code on GitHub you would use “my_awesome_poll” in place of “poll_1” and the channel “my_awesome_channel” instead of “polls”.

As far as snipets go - I rarely use them. I would just place all this code in an individual template. I think creating a bunch of snipets just makes things more complicated then they have to be. That may just be personal preference, however.

msmith
# 4
msmith

FYI: The {if my_poll} doesn’t work since the settings always get saved into the poll regardless of if any options exist.