#1 July 31, 2014 1:40pm

jesse.glaves
Member
Registered: June 28, 2014
Posts: 124

Nested Module Structure

I'm interested in created a module that has a couple of levels. Each month, we release a newspaper here on campus at my college. We have a section called Word on Campus, where we ask the students a question, and their response is printed in the paper. I would also like to put these responses, along with their photo, name, major in the website. Using the module as I understand them, I can create fields for their responses, i.e. Name, Photo, Major, Response. But, how would I group these responses based on the question though? Where would I enter the question that these responses are based on? i.e.

Question: What will you remember most about your academic career, and what are your post-graduation plans?
    |
    |    Field - Response: The great part of getting my degree through...
    |    Field - Name: Jane Doe
    |    Field - Major: Bachelor of Science
    |    Field - Photo: Upload photo

Where I usually have 8 responders per question each month.

Thanks!

Offline

#2 August 2, 2014 9:57am

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

Re: Nested Module Structure

Will you be soliciting the responses from the website or manually entering them in the admin?

Offline

#3 August 4, 2014 11:22am

jesse.glaves
Member
Registered: June 28, 2014
Posts: 124

Re: Nested Module Structure

Manually entering smile

Offline

#4 August 4, 2014 12:17pm

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

Re: Nested Module Structure

What I would usually do is create two tables for the data:
- Questions
- Responses

Then you'd use an INT(11) column in the responses table to reference the id column in the questions table. You can use the "List" field type and set it to Database Populated to pull a dropdown of questions to reference when building out your form in BigTree.

You can also use the "Grouped List" view type and group on the question column in the responses table if you'd like your view to nicely separate out the responses.

Offline

#5 August 4, 2014 12:49pm

jesse.glaves
Member
Registered: June 28, 2014
Posts: 124

Re: Nested Module Structure

Yeah, I actually ended up doing something similar to that. I just added a questions table, and linked it to the responses form with a database populated list field. It doesn't exactly group everything together the way I envisioned, but it seems to be working ok as long as I select the appropriate question in the list on each response. I also added a form to manage the questions. One thing I did notice is that when I add a new action to the module to edit the questions, the edit button ("pencil" icon) route always defaults back to the standard /edit route, even though the action is designated as "/edit-question". I noticed that this behavior is even present in the events module that you shared with me, so I think there may be a bug there. In the events module, if you choose view categories, and click on the pencil icon to edit the category, you get the message, "The item you are trying to edit no longer exists.", because it's not pointing to the route in the edit category action of "/edit-category". Instead it's defaulting to the "/edit" route.

I did play around with the grouped list option, but it seems like the two tables would have to be tied together with some sort of id column, which I didn't have available. It'd be nice just to be able to drag the responses into the appropriate question group, but the way it's currently set up should work ok. We only update these questions once  a month anyway.

Offline

#6 August 6, 2014 9:26am

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

Re: Nested Module Structure

You can fix the "edit" issue by editing your View and choosing the related form. It will then route to the proper edit.

Offline

#7 August 6, 2014 11:31am

jesse.glaves
Member
Registered: June 28, 2014
Posts: 124

Re: Nested Module Structure

Perfect, thanks.

Offline

Board footer

Powered by FluxBB

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