Skip to content
  1. Extras
  2. VoteForms

VoteForms

Voting and polls system for MODX Revolution

GithubLatest releases

Features

  • Form constructor for voting in modx manager
  • Voting results with sorting and search in modx manager
  • Forms and voting results on the site, live updates via ajax
  • Bind results to a resource or other object by creating a new thread

System settings

NameDefaultDescription
voteforms_assets_url{assets_url}components/voteforms/URL to frontend files
voteforms_core_path{core_path}components/voteforms/Path to component
voteforms_frontend_css[+cssUrl]]web/voteforms.cssPath to CSS file. To use custom styles - specify path here, or clear and load manually via site template.
voteforms_frontend_js[[+jsUrl]]web/voteforms.jsPath to JS file. To use custom scripts - specify path here, or clear and load manually via site template.

VoteForm snippet parameters

NameDefaultDescription
idForm id, required
threadresource-[[*id]]Thread name for results. Default resource-[[*id]]
tplRowtpl.VoteForms.rowChunk for each field
tplOutertpl.VoteForms.outerChunk for whole output
sortbyindexSort field
sortdirASCSort direction
submitfalseUse submit button in form

getVoteFormRating snippet parameters

NameDefaultDescription
formForm id, required
resourceResource id. Default: current
fieldField id - output results for this field only
threadresource-[[*id]]Thread name. Default resource-[[*id]]
tpltpl.VoteForms.ratingOutput chunk
starstrueOutput rating widget or not

Usage

modx
[[VoteForm? &id=`1`]]
modx
[[getVoteFormRating?form=1]]
modx
[[getVoteFormRating?form=1&field=2]]

With pdoResources: sort resources by rating from form id 1

modx
[[pdoResources?
  &class=`modResource`
  &parents=`0`
  &tpl=`@INLINE <li>[[+pagetitle]] - <span class="badge">[[+rating]]</span> </li>`
  &leftJoin=`{
    "VoteFormThread": {
      "class": "VoteFormThread",
      "on": "modResource.id = VoteFormThread.resource AND VoteFormThread.form = 1"
    }
  }`
  &select=`{
    "modResource": "*",
    "VoteFormThread": "rating"
  }`
  &sortby=`VoteFormThread.rating`
  &sortdir=`DESC`
]]

Placeholders in component chunks

VoteForm - tpl.VoteForms.outer

output, rating_max, snippet call parameters

VoteForm - tpl.VoteForms.row

  • VoteFormField: id, index, form, name, description, type
  • User vote result: record, rating_max

getVoteFormRating - tpl.VoteForms.rating

  • VoteFormThread: id, resource, form, name, rating, users_count
  • VoteFormForm: form.id, form.name, form.description, form.active, form.rating_max
  • With field parameter:
    • VoteFormField: field.id, field.index, field.form, field.name, field.description, field.type
    • rating and users_count for this field
  • Voting widget: stars

Development

Report suggestions and bugs to Github.