#1 February 11, 2013 6:46pm

designbyblake
Member
Registered: February 11, 2013
Posts: 6

Multiple Many to Many fields don't like the edit page

Hi all,


I'm in the process of checking out BigTree and my initial impression is very positive. After seeing Tracey's presentation at Refresh Baltimore we thought it would be only fitting to build the Refresh Baltimore website in Big Tree.


While building the site I've created 3 modules, Events, Speakers & Locations. I've created 2 Many to Many fields in the Events module, one for Locations and one for Speakers. When I add a new event everything works perfectly (writes to the proper join tables) however when I go back to edit an event only the first Many to Many field is displayed, in this case the Locations relationship.


Since there is no Speakers field being displayed when you save the Event the Speaker is removed from the join table. At this point if you go back to edit the same event the Locations Many to Many field displays and so does the Speakers Many to Many field which of course is now empty. I guess my bug is only 1 filled out many to many fields shows at a time.


Also do you have any plans on making a One to Many field or does that need to be custom? I only need one location per event.


thanks,


Dan

Offline

#2 February 11, 2013 8:31pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 978

Re: Multiple Many to Many fields don't like the edit page

Dan,

I think this may be related to a bug that Ben found today, but if this isn't the case let me know -- if you've tagged everything possible to a Many to Many then the whole many to many disappears when you try to edit the item the next time around. This is due to the (ideal) behavior of the tagger not showing up if there's nothing available to tag. It's on our list for an RC3 fix that will hopefully roll out around the beginning of March.

As far as One to Many, that's actually a field type Ben whipped up earlier today — hopefully he can respond here. He can probably export it and post it for anyone to have. I'm not sure if we're going to make it a core field type in the future or not but it's a possibility in 4.1 (we're feature frozen now for 4.0).

Offline

#3 February 11, 2013 10:43pm

designbyblake
Member
Registered: February 11, 2013
Posts: 6

Re: Multiple Many to Many fields don't like the edit page

Actually I had nothing tagged yet, though I did have tagging turned on for the Events module. I turned it off to see if that would change anything, it did not.


If Ben wants to share the One to Many field type it would be greatly appreciated. For the Refresh site it would come in handy but overall I can see a lot of potential for its use. Regardless, the work you all have done with Big Tree is very impressive for this early of a release.

Offline

#4 February 11, 2013 10:49pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 978

Re: Multiple Many to Many fields don't like the edit page

I'm probably being confusing by saying "tagged". I'm not really sure what the proper terminology for the action is when adding a relationship in a many to many wink

What I mean is this: If you have two categories you can relate to an event and you relate both of them the next time you load up the edit screen for that event the category many-to-many will fail to load. I can replicate that behavior with one or two many to many fields.
If there are two categories / locations available and I relate one of each to the event they seem to work properly. If a single relationship in each of the many to many's doesn't work I'm not sure what's going on (maybe you can create us an admin user or something and we can look into it some more on your installation).
Thanks for the kind words about BigTree!

Offline

#5 February 11, 2013 11:28pm

designbyblake
Member
Registered: February 11, 2013
Posts: 6

Re: Multiple Many to Many fields don't like the edit page

I only have everything local at the moment but maybe we can arrange something where I swing up to the office towards the end of a work day. I work a few blocks from your office.

Offline

#6 February 11, 2013 11:58pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 978

Re: Multiple Many to Many fields don't like the edit page

Cool, whatever is most convenient for you!

Offline

#7 February 16, 2013 11:10am

benplum
Administrator
Registered: March 30, 2012
Posts: 54

Re: Multiple Many to Many fields don't like the edit page

Here's a link to the Many to Array field. Install it by uploading the package through the developer section. The field type will require you to set a source table when building your forms. It will then store an array of the select item's IDs, so set the corresponding database column to 'text,' or at the very least 'varchar'. Let me know if you have any questions.

https://dl.dropbox.com/u/1184382/many-to-array.tgz

Offline

#8 February 17, 2013 6:04pm

designbyblake
Member
Registered: February 11, 2013
Posts: 6

Re: Multiple Many to Many fields don't like the edit page

Thanks Ben, the field works great. There is a small bug where you can't delete an item out of the array. The dialog comes up but the delete button does nothing. For me at the moment this is not a big deal.

Offline

#9 February 18, 2013 9:33am

benplum
Administrator
Registered: March 30, 2012
Posts: 54

Re: Multiple Many to Many fields don't like the edit page

What context are you using the field type (page, module, callout, setting)? It's working on my end, but maybe I;m missing something.

Offline

#10 February 19, 2013 9:35pm

designbyblake
Member
Registered: February 11, 2013
Posts: 6

Re: Multiple Many to Many fields don't like the edit page

I'm using the field type in a module.


It looks like select.customControl.add function in deleteItem is what is causing the issue. The error is:
"Uncaught TypeError: Cannot read property 'length' of undefined" in main.js on line 367 which is "this.Element.options[this.Element.options.length] = op;" in the code.


I've commented out the line with select.customControl.add function for now. So now the delete works it just doesn't add the option back into the custom select (or hidden select) until you save and go back to the page.


For us now this isn't a huge issue as I don't expect to be deleting too much.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.