#1 June 24, 2015 4:33pm

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

Matrix Field Titles and Subtitles

Hi there. I'm trying to use the Matrix field that contains a list of upload fields. I've went through and filled out the title for each of the upload fields, and tried a couple of the subtitles too, but the title and subtitle info doesn't seem to be showing in the database anywhere. I can't find where to retrieve that information. There is a blank "__internal-title":"","__internal-subtitle":"" record before everything else in the database value, but they are empty and they only appear once, not a pair for each upload field like I would expect. Thanks!

Offline

#2 June 25, 2015 10:09am

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

Re: Matrix Field Titles and Subtitles

Currently Matrix doesn't support using the Upload field type (or any input[type=file]) as a title field. At first I was pretty confused as to why it was this way and did some testing, on first save it works completely fine. The issue is when you go back in and edit an item that is using the upload field for the title and don't modify the upload -- when you save this time it'll save an empty title since the input doesn't have a value.

I then tried to use the hidden input that stores the upload's current value but BigTree stores the full path of the file after it's saved so the title may begin as "file.jpg" but the next time you save it'll become "http://www.website.com/files/file.jpg".

We could do some path magic to try to extract the base name of the file again in that instance but I'm not sure it's worth it in the end. What's your use case here? Just a list of files that don't have separate titles? Maybe we can figure something out.

Offline

#3 June 25, 2015 12:54pm

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

Re: Matrix Field Titles and Subtitles

Thanks Tim. I'm working on a College Council Reports page. The module will allow a user in the Director's office to enter multiple reports, a single compiled full packet file, a single agenda file, and a single minutes file for each month's council meeting. Each month is one entry in the module. Reports from different areas/departments of the college are prepared for the council to keep them informed about the activities in the various areas of the college. I want to have a slot to upload each report as they are received from the departments, because they don't all come in at the same time.

The fields are as follows:

Date > Date Field
Reports > Matrix Field
        College Director (id: director) > Upload Field
        Administrative Services (id: admin_services) > Upload Field
        Assistant Director for Academic Affairs (id: asst_dir_academic_affairs) > Upload Field
        etc...
Full Meeting Packet > Upload Field
Agenda > Upload Field
Minutes > Upload Field

When a meeting entry in the module is archived, it is added to an archive of previous meetings that can still be accessed.

So the issue is specifically with the matrix field that I am using for the reports. I don't really need the name of the file like you mentioned, although I could see how that would be very useful for other applications. I want to be able to access the Title and Subtitle values that are entered when creating the matrix > upload fields:

matrix

With the current functionality, because my ID value doesn't usually match the value I want to show for the title, I would currently have to write code to manually enter the title like so:

echo "<tr><td>College Director</td><td><a href="\"".$report["director"]."\">Download</a></td></tr>";
echo "<tr><td>Administrative Services</td><td><a href="\"".$report["admin_services"];
echo "<tr><td>Assistant Director for Academic Affairs</td><td><a href="\"".$report["asst_dir_academic_affairs"];

Because those values don't seem to be included in the reports column:

[{"__internal-title":"","__internal-subtitle":"","director":"{staticroot}files\/pages\/director.pdf","admin_services":"{staticroot}files\/pages\/adminservices.pdf","asst_dir_academic_affairs":"{staticroot}files\/pages\/asstdiracademicaffairs.pdf"}]

I was able to find the titles and subtitles in the bigtree_modules_forms table. I guess I could figure out a way to blend these two columns' values in PHP, but that seems like an extra step that shouldn't be necessary.

{"title":"Reports","subtitle":"Upload the individual reports here","type":"matrix","options":{"max":"1","style":"callout","columns":
[{"type":"upload","id":"director","title":"College Director","subtitle":"test","display_title":"on","options":""},
{"type":"upload","id":"admin_services","title":"Administrative Services","subtitle":"test","display_title":"on","options":""},
{"type":"upload","id":"asst_dir_academic_affairs","title":"Assistant Director for Academic Affairs","subtitle":"test","display_title":"on","options":""}
]},"column":"reports"}

Maybe I'm just thinking of this the wrong way, but it seems like any values you enter for each field when creating the module should show up in that field's column in the table. Any help is appreciated!

Thanks Tim.

Offline

#4 June 25, 2015 1:42pm

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

Re: Matrix Field Titles and Subtitles

Another issue that I'm having with the matrix field is that the list items always appear blank for some reason. It would be nice if I could choose one of the values to be the display text. I've tried checking the "Use as Title" checkbox but it doesn't seem to make a difference.

OF_Qu85kVgCTbBqNkmC8esz0-zvC0ZZebUQlm2_q9iM?size=1600x1200&size_mode=2

Offline

#5 June 25, 2015 3:48pm

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

Re: Matrix Field Titles and Subtitles

Re: the first post, you're right that a Matrix column's title and subtitle info isn't going to come through in your table-stored data and is only accessible in bigtree_module_forms. This is because that information was intended to be instructional information for admin entry, not pulled to the front end of the site. If for some reason you needed those titles / subtitles you'd only need to pull it once from bigtree_module_forms -- it wouldn't need to be blended with your entries as it's going to be the same for every entry.

It looks like you tried to paste some dropbox image links but I'm not seeing them come through. "Use as Title" is the correct checkbox to make that "column" value show for the description of the entry, if it's not working can you send me your bigtree_module_forms entry for that form along with your table structure for the related table?

Offline

Board footer

Powered by FluxBB

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