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.

Data Model Questions /

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

Generate Add/Edit/Delete forms of DataObject in FrontEnd (scaffolding)


Go to End


7 Posts   2190 Views

Avatar
PeterR

Community Member, 15 Posts

2 February 2015 at 5:18am

Hi all,

can you tell me please if it is possible to generate front-end forms for my DataObjects with actions like add/edit/delete?

For now, I have created it manually.
It means, that in my "Finance" controller I have created four actions: index, add, edit, delete. This actions handles SS_HTTPRequest - parses ID from url and loads record (for edit/delete).
Then, I have created templates like finance_add.ss, finance_edit.ss, finance_delete.ss and for each template I have created forms.
It works, but it is not very "pretty" and I'm looking for something more generic without need of writing or copy&pasting too much code.

Could you please suggest me what is best practice of front-end forms and if it is possible to use scaffolding in front-end?

Thank you very much, I will appreciate any code example :)

Avatar
swaiba

Forum Moderator, 1899 Posts

2 February 2015 at 11:25pm

This is a great example of how this is done in 2.4

Avatar
PeterR

Community Member, 15 Posts

3 February 2015 at 12:08am

Hi swaiba,

thanks, could you please provide me a link with this example ?

Avatar
swaiba

Forum Moderator, 1899 Posts

3 February 2015 at 12:09am

Avatar
PeterR

Community Member, 15 Posts

3 February 2015 at 12:14am

I saw it before but I did not try to test it. I was in doubt if it will work on version 3.1, because in description there are requirements SilverStripe 2.3, and code of this module was last modified before 3 years.

Do you think it is working with actual release of SilverStripe?

Avatar
swaiba

Forum Moderator, 1899 Posts

3 February 2015 at 12:16am

I've no comment on whether it works on 3.1 or not - I'd advise you try it out.
I'm not aware of anything too large that would have changed in this area - but if a function is depreciated the docs normally lead you to the replacement.
As I said this is a very good example, not a complete working solution.

Avatar
PeterR

Community Member, 15 Posts

3 February 2015 at 12:19am

Alright, I will try it.

Thank you :)