Jump to:

5453 Posts in 1674 Topics by 1198 members

Customising the CMS

SilverStripe Forums » Customising the CMS » variable form elements

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

Page: 1
Go to End
Author Topic: 834 Views
  • aliT
    Avatar
    Community Member
    2 Posts

    variable form elements Link to this post

    Hi there,

    im trying to create a gallery section for a client's website.

    What i want to do is create a field in the CMS where they can add a maximum of 10 images, and then in my template control these. The problem is that there could be any number of images from 1 to 10, and this will change for each instance of the page. Im not sure how to create a form field that is variable in this way. Or instead to create a control block in the template that will handle each image, like you would with pages.

    Im a bit of a beginner at silverstripe, so any help would be great!!

    ali.

  • aliT
    Avatar
    Community Member
    2 Posts

    Re: variable form elements Link to this post

    I seem to have found what looks like a possible solution in the recipies.

    http://doc.silverstripe.org/doku.php?id=recipes:grouping_fields_from_your_data_object

    unfortunately i can't get it working, when i go to upload an image in the cms it fires annon specific error.

    Am i right in presuming you have to create image feilds in the database ($has_one) and also create feilds in the cms?

    any help would be greatly appreciated!

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: variable form elements Link to this post

    If you want an unlimited (or large amount of items) per page then your best bet is to use a $has_many relationship and some type of TableField - http://doc.silverstripe.com/doku.php?id=complextablefield . For an example see the 5th tutorial.

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