Jump to:

1969 Posts in 1272 Topics by 606 members

Form Questions

SilverStripe Forums » Form Questions » Images shown next to checkboxfields

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

Page: 1
Go to End
Author Topic: 552 Views
  • Drumstick
    Avatar
    Community Member
    20 Posts

    Images shown next to checkboxfields Link to this post

    Hi there

    Why I can't show a picture (with the code shown after) for a checkbox but for a radio button it works. I need to show the image next to the checkbox field, so that the user can check images and send them to a next page. When I take the checkboxsetfields then it just shows text but not the img tag and the source of the picture. When I choose optionssetfields then it works. I receive an image.

    $map = Referenzen::get()->map('ID','Photo');

    // Instantiate the CheckboxsetField
    $FieldList = new FieldList(

    new CheckboxSetField(
    $name = "picture",
    $title = "picture print",
    $source = $map,
    $value = $map[0]

    )

  • Drumstick
    Avatar
    Community Member
    20 Posts

    Re: Images shown next to checkboxfields Link to this post

    I found the solution.....the more you know....it gets better....

    Create a new CheckboxSetField class and modify the associated template as well. Then it works wonderfull.

    You have your Checkboxes and the images near by.

  • iraira88
    Avatar
    Community Member
    17 Posts

    Re: Images shown next to checkboxfields Link to this post

    Hi,

    can you show and explain me your solution step by step? I have a similar situation: I also want to have images next to my checkboxfields. Furthermore I should be able to add or change these images in the backend. How can I do this?

    I'm a little helpless here so I would really appreciate your help!

  • Drumstick
    Avatar
    Community Member
    20 Posts

    Re: Images shown next to checkboxfields Link to this post

    Hi

    when you have a look under the folder framework - forms - there are all the classes of your form fields. And the associated template is in the folder framework - templates - forms

    Now you can make a new class and make your own template.

    It needs time to understand objectoriented programming. I think it's worth reading a book about it and reading about Zend Framework for better understandig of some things.

  • Drumstick
    Avatar
    Community Member
    20 Posts

    Re: Images shown next to checkboxfields Link to this post

    Hi

    This helps too

    have a look trought the tutorials for first understanding

    http://doc.silverstripe.org/framework/en/tutorials/

    and read the books for deeper understanding
    http://www.silverstripe.org/books

    552 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.