How do you target a Matrix cell for File upload?
Posted: 27 January 2011 08:53 AM   [ Ignore ]
Has a Nice Profile
RankRank
Total Posts:  171
Joined  2010-03-01

The docs don’t mention how to code a form that allows uploading a file to a Matrix cell. How do you target say, the first cell if it’s called image and the Matrix field name is documents_download?

Profile
 
 
Posted: 01 February 2011 10:57 PM   [ Ignore ]   [ # 1 ]
Absolute Heartthrob!
Avatar
RankRankRankRankRank
Total Posts:  10369
Joined  2008-09-29
{exp:safecracker channel="portfolio" return="/admin/ENTRY_ID" entry_id="{segment_2}" preserve_checkboxes="yes" safecracker_head="yes"}

{
!-- Matrix field with upload cell --}
{field
:your_matrix_field_name}

<input type="submit" name="submit" value="Submit" />

{/exp:safecracker} 

If you don’t want to show the entire matrix field… then it gets really complicated. Basically… each field type handles itself in the SAEF. So if you’re trying to just display one field in the matrix, you’ll find it rather difficult.

 Signature 
Profile
 
 
Posted: 23 March 2011 09:46 AM   [ Ignore ]   [ # 2 ]
Wallflower
Rank
Total Posts:  16
Joined  2010-05-31

Hi Chris,

Thanks a bunch for the awesome add-on. Now I got my Matrix field showing up, but how can I make the file manager NOT display, or simply localize it to the user’s photos? Otherwise, when they go to add an image they see the entire library of photos.

Jae

Profile
 
 
Posted: 23 March 2011 09:51 AM   [ Ignore ]   [ # 3 ]
Absolute Heartthrob!
Avatar
RankRankRankRankRank
Total Posts:  10369
Joined  2008-09-29

This is the reason that we included SafeCracker file. The standard file manager field will always do this. You need to change the field type to SafeCracker file, or add a new file field that uses SafeCracker file.

 Signature 
Profile
 
 
Posted: 23 March 2011 10:13 AM   [ Ignore ]   [ # 4 ]
Wallflower
Rank
Total Posts:  16
Joined  2010-05-31

Thanks Chris. I guess this means Matrix-type gallery may not be the right choice for a public guest to upload images?

Or, can the SafeCracker file be a cell within a Matrix field?

Profile
 
 
Posted: 23 March 2011 07:01 PM   [ Ignore ]   [ # 5 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Yes, you can use SC File as a matrix cell.

Profile
 
 
Posted: 24 March 2011 10:46 AM   [ Ignore ]   [ # 6 ]
Wallflower
Rank
Total Posts:  16
Joined  2010-05-31

Hmmm - how would you target just a cell within a Matrix? I think {field:matrix_cell} is a no-go. Thanks guys!

Profile
 
 
Posted: 24 March 2011 07:02 PM   [ Ignore ]   [ # 7 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

You cannot do that.

Profile
 
 
Posted: 25 March 2011 11:51 AM   [ Ignore ]   [ # 8 ]
Wallflower
Rank
Total Posts:  16
Joined  2010-05-31

K - thanks Rob.

Profile