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.

Customising the CMS /

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

Draggable multiple fields as in Userforms


Go to End


4 Posts   1162 Views

Avatar
DesignCollective

Community Member, 66 Posts

7 January 2012 at 3:52am

Hi guys, I've been in love with the user experience of the UserForms module. There are many occasions where I would need to add a various number of sortable fields and I've either used multiple static fields or DataObjectManager. I guess I'm curious about the next level to learn how to do something like that in the UI.

A + button which will add a particular field (e.g. Dropdownfield). There is the DRAG option too, which I've seen in some other modules so I am assuming it's actually part of the CMS.

Would anyone advanced here be able to give a little tutorial and explain the steps needed?

Thanks a bunch!!

Avatar
swaiba

Forum Moderator, 1899 Posts

7 January 2012 at 5:24am

I use Widgets for this... or am I missing the point of what you are asking?

Avatar
DesignCollective

Community Member, 66 Posts

7 January 2012 at 6:25am

Yeah, kinda :)

I generally use widgets to manage items in the Sidebar. In this case, I am talking about a $has_many relationship, often ordered. Eg, attaching / featuring a few Dataobjects or pages to a particular page.

Avatar
Willr

Forum Moderator, 5523 Posts

7 January 2012 at 8:59pm

Take a look at UDF (UserForm.js) and see how it works if you're interested!

Drag and drop is mostly handled by jQuery, the + functionality is an ajax call to a controller which returns the HTML segment with the new form field. In the javascript I then add that HTML to the page.