Log in

Max number of poll choices is per post and not per poll

  • 1
  • 18 May '16
This poll has 10 choices
This poll also has 10 choices

[poll name=3]
# This poll has only two choices, but the post exceeds the limit of 20 choices and fails to render
1. 1
2. 2
[/poll]

nitelyEsteban Castro Borsani
  • 18 May '16

Yes, works as expected.

About this feature: the number of polls is limited by the number of choices, there can be 20 (by default) choices per comment, that means 1 poll with 20 choices, 2 polls with 10 choices each and so on.

  • 18 May '16

Any way to validate this in the form then? I saw there is a max_num but that only works if you have one poll.

nitelyEsteban Castro Borsani
  • 18 May '16

I saw there is a max_num but that only works if you have one poll.

That's in topic.poll, that app is deprecated. The new polls app is comment.poll. Actually, I was about to implement deprecaton notices ala django, that's one of the reasons I haven't bumped Spirit version to 0.5.

Any way to validate this in the form then?

You want to prevent the user from posting an invalid poll?

Currently, the markdown rendering is ran after the form validation. Since MD does not throw/inform about errors, that's the way how polls work.

It should be possible to show an error after publish/save the comment without major changes to the code. It's also possible to prevent submitting the form, that would require making the MD rendering part of the form validation.

But showing errors seems weird to me. MD does not tell about errors or how to fix them. If a parenthesis is missing in a link or image, it just does not get rendered.

  • 18 May '16

But showing errors seems weird to me. MD does not tell about errors or how to fix them. If a parenthesis is missing in a link or image, it just does not get rendered.

True, and that's fine. But in this case it's not a syntax error. The user has no way of knowing what's wrong.

nitelyEsteban Castro Borsani
  • 2
  • 18 May '16

The user has no way of knowing what's wrong.

They should count the number of choices, haha. Would showing a message after the comment is saved be ok? I'd like to avoid making MD part of the form validation

Or maybe just add a note in the markdown help dialog? (there is no markdown help dialog ATM, though)

Or what about showing the error in the comment preview? (also, actually rendering the polls in the preview which is missing)

Reply