Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

variable form elements

Go to End

3 Posts   1213 Views


Community Member, 2 Posts

14 June 2009 at 3:10am

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!!



Community Member, 2 Posts

15 June 2009 at 12:05am

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

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!


Forum Moderator, 5523 Posts

16 June 2009 at 5:35pm

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 - . For an example see the 5th tutorial.