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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

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

Add / Remove Dynamic Fields in CMS


Go to End


8 Posts   3751 Views

Avatar
MattKenefick

Community Member, 13 Posts

30 August 2008 at 5:07am

If I have a CMS that I want lets say... cycle through a number of quotes... is there a way I can have 3 fields laid out to start, then give the user the ability to add field 4,5,6,7,8,9,... while they're in it?

Avatar
MattKenefick

Community Member, 13 Posts

30 August 2008 at 10:18am

maybe i'm not explaining this well.

a way to have a "+" button that will add an additional field to the current section you're editing. (not to a form on the page, but extra data) is this even possible?

Avatar
Willr

Forum Moderator, 5523 Posts

30 August 2008 at 11:06am

You probably want to look at using a TableField of some sort - http://doc.silverstripe.com/doku.php?id=tablelistfield

You can make a DataObject of a 'Quote' then a table field of quotes. This will give you the ability to add / remove quotes

Avatar
MattKenefick

Community Member, 13 Posts

30 August 2008 at 11:35am

Less than clear on this. This'll set it up in the CMS? How do I apply this function to create new fields in the CMS dynamically ?

Avatar
Willr

Forum Moderator, 5523 Posts

30 August 2008 at 11:53am

Sorry I cant expand anymore on that, running between things at the moment. Have a look at the tutorial tho. http://doc.silverstripe.com/doku.php?id=tutorial:5-dataobject-relationship-management . Ill post an example when I have a sec!

Avatar
Fuzz10

Community Member, 791 Posts

31 August 2008 at 4:33am

Hi Matt,

Yeah, this is perfectly feasible ... It'll take some (minor) programming, but no problem..

Have a look at the tutorial Will posted and it'll get clear.

Avatar
Willr

Forum Moderator, 5523 Posts

31 August 2008 at 12:12pm

Hey Matt,

I have written up a quick tutorial for you on the wiki - http://doc.silverstripe.com/doku.php?id=recipes:example_of_quotes_on_a_page . The code you need to get it to work is pretty small as you can see I just tried to expand it a bit. Let me know if you have any questions

I will also attach my code to the page for you.

Avatar
Fuzz10

Community Member, 791 Posts

1 September 2008 at 10:33am

Very cool write-up Will ! I'm sure this'll help a lot of people !