Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » show dataObjects as tabs in fronend

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

Page: 1
Go to End
Author Topic: 304 Views
  • soolan
    Community Member
    11 Posts

    show dataObjects as tabs in fronend Link to this post

    I have two data objects: one for Products, one for Features.

    I want to show them in front-end as two tabs in a Tabset. So I created a Form in my controller class

    class Product_Controller extends Page_Controller{
    public static $allowed_actions = array('myForm');

    public function myForm() {
    // Create fields
    $fields = new FieldList(
          new TabSet(
           $name = "TheTabSetName",
           new Tab(
              $title='Tab one',
        new HeaderField("A header"),
           new LiteralField("info from dataobject1.") // to keep it simple I replace the code with some place-holder texts
          new Tab(
        $title='Tab two',
        new HeaderField("A second header"),
        new LiteralField("info from dataobject2.")

    return new Form($this, 'myForm', $fields);

    And here it is my Product.ss file:
    <div id="myform">
    <h2>my form</h2>
    <div class="Content">

    But it doesn't show the form.

    May I ask you what I'm doing wrong here?

    The other question is should I use forms to show tabbed view in frontend?

    Thank you.

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.