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.

Data Model Questions /

SS3 along the lines of complextablefield


Reply


7 Posts   522 Views

Avatar
voodoochile

Community Member, 52 Posts

11 October 2013 at 10:20pm

Hi all

i have a dataobject that has several entries in it i want to create a form that lists each object along with an input field that on submission inserts each item with a seperate ID and a predetermined RelationID to another dataobject (i hope that make sense)

Question one - is a form the way to go with this or is there something similar to complextablefield ?

Question 2 - can this be done?

I am looking for a start point or a direction to go in as i am not sure where to start with this, at present you have to add each object one at a time to build the list and it is slow and confusing for users idealy to have a list add the values all in one page is the goal?

can anyone help?

Thanks

Avatar
zenmonkey

Community Member, 532 Posts

14 October 2013 at 7:16pm

I think what you're looking for is the BulkEditingTools

http://addons.silverstripe.org/add-ons/colymba/gridfield-bulk-editing-tools

It should get you most of the way there, byond that you may need some logic in the onBeforeWrote to sort out your custom relations

Avatar
voodoochile

Community Member, 52 Posts

14 October 2013 at 8:21pm

Hi Zenmonkey

Thanks for the Reply .. i will have a look at this, i'm not sure if it will fit the bill yet but looks like a good direction to start with.

Avatar
voodoochile

Community Member, 52 Posts

28 October 2013 at 11:12pm

ok .. so bulk editing tools is out as it does not support insert to has_many relations and i think what i'm trying to do goes beyond that anyway may not even be able to be done.

currently i have been playing with doing it via a form but alas my php skills are not that great as yet.

i have managed to build a form that creates a list of records from two tables and also gets some information into hidden fields all looks good ... Right or wrong this is just an html form, now i'm not to sure on the submission of the form result to the db.

like i said this may be the completely wrong approach but i couldn't see how to get the information from the two tables into a single form within the framework. anyways the form needs to insert each tables list result to their respective new tables. these table are different to the tables the forms information comes from ( the reason for a form here is that the user is required to add a value before submitting the form)

the form produces a list of products from one table and a second list of product from another table the user then adds a weight value to the required products and submits the form this then inserts each list into two new tables.

doing this through the has_many relation in the cms each product has to be added one at a time (lots of clicks and things that can go bump from dfu mistakes) by presenting a form with all products listed (there will only ever be 30 products at most) the end user only has to go down the list and add the weight values and click submit (2-3 clicks at the most).

if any one has any ideas or is there something i have missed would like to hear from you.

Avatar
simon_w

Forum Moderator, 474 Posts

29 October 2013 at 10:01am

Have a look at the [url=http://addons.silverstripe.org/add-ons/simonwelsh/gridfieldrelationhandler]GridFieldRelationHandler[/url] module, which adds the relation management that the HasOne/HasMany/ManyManyComplexTableField classes provided.

Avatar
voodoochile

Community Member, 52 Posts

29 October 2013 at 11:11am

Hi Simon

have had a look thankyou for the reply and suggestion, GridFieldRelationHandler goes some way to solving the problem it would allow the user to select a group of products to be included in a new table if i have understood it correctly.

where it falls short is the user would have to then still go into each product and add the weight value. unless this can be done from the summary fields?

also could it create the list of products from 2 tables or would the adding have to be done seperately?

to acheive what i am wanting to do i see a form as the best way at the moment. but it is clunky to do at best and i think a short term fix only until my php and silverstripe skills grow alot more.

Avatar
voodoochile

Community Member, 52 Posts

29 October 2013 at 11:29am

i have mad a quick diagram of what i am doing hopefully it may help..

Attached Files