5514 Posts in 1733 Topics by 1219 members
|Go to End|
31 March 2009 at 7:01am Last edited: 31 March 2009 11:57am
I am looking to build a site, and for one of my templates, the user should be able to post an unlimited number of a certain content type, which in this case is links. For each link, I want the user to be able to add a title, and URL.
Instead of creating say 10 link fields for the client to populate in the CMS, I would like this to be flexible, so the client can have as many of these as they need. Is there a way in the CMS that I can make a "repeating field", so the client can add or remove the elements as needed? If so, can anyone tell me how to go about setting these up?
1 April 2009 at 2:21am
Sounds like you need to build a link data type having fields URL and title. Then, from your page type, create a one-to-many relationship with the link data type. On your page type, you could use something like DataObjectManager in getCMSFields() to give you a way to create the link entries from the CMS admin interface.
7 November 2012 at 4:42am
Sorry to bump such an old thread but did you ever get this working?
I would like to do this in SilverStripe 3 but as yet haven't found a way.
I can generate extra form fields using jQuery, however it only saves the last field to the Database.
Any help would be really appreciated.
7 December 2012 at 2:33am
You need to add that field as its own data object and use a $has_many relation. Then you can use a grid field to manipulate it.
|Go to Top|