Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Poll module

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1190 Views
  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Poll module Link to this post

    Hi, I am using this module, and I think I'm satisfied by it, but is there a way to write my own template for showing the poll?
    I couldn't figure it out on my own, so I guess it isn't rly as trivial... or is it?

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: Poll module Link to this post

    Well the template is pretty basic - https://github.com/mateusz/silverstripe-polls/blob/master/templates/PollForm.ss. That is trival to customize (just copy to your theme).

    However I imagine you want to alter the form html inside that (which comes from $DefaultForm) which is a little tricker to alter. The form already has its own class setup 'PollForm' (https://github.com/mateusz/silverstripe-polls/blob/master/code/PollForm.php) so you just need to define a PollForm.ss template

    This documentation page shows how to have a custom form template - http://doc.silverstripe.org/sapphire/en/topics/forms#using-a-custom-template.

  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Re: Poll module Link to this post

    Thanks, I think I understand what needs to be done and will try it out today/tomorrow.
    Thank you, if i have further troubles I will ask again here.

  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Re: Poll module Link to this post

    Well tbh I am still not sure where/how to do this.
    I have included the wanted template (I hope in full) in the attachment. can someone plz help with including it into pollmodule?

    Attached Files
  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Re: Poll module Link to this post

    Has any1 tried making a custom PollForm.ss?

  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Re: Poll module Link to this post

    Could rly use some more help with this.
    bump

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: Poll module Link to this post

    What you want to do is copy the default 'Form.ss' template (sapphire/templates or on that wiki page) and make a PollForm.ss file in your theme - themes/yourtheme/templates.

    You can then customize that PollForm.ss template as you wish, remembering to use ?flush=1 when you view your changes on the site to ensure the templates are refreshed.

    Somethings you won't be able to customize (like individual form fields) easily as these come from the PHP files.

  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Re: Poll module Link to this post

    Hey mate, it seems it's not all about PollForm.ss
    I was looking at the form for a few days now, trying to make it and I failed, but then I figured it out. It is kinda messy, but you have to change /polls/css/ShowPoll.css if you wish to make anything out of it.
    I still don't know where to change one thing : radio buttons (or checkboxes) . I have my own box (class "radio") with a bit of javascript that I have to implement, but tbh don't know where to do it.
    I won't mind if it's a global change (for everything, not only pollform) since it's the detail they want to use.
    In any case Willr thank you for helping me, I eventually found where the change needs to be done.

    1190 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.