ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using Safecracker to Display a Playa Field within a Matrix

April 03, 2011 4:40pm

Subscribe [2]
  • #1 / Apr 03, 2011 4:40pm

    Andy J.

    58 posts

    Not sure how to go about this, but I’m trying to use Safecracker to display a Playa field that’s within a 3 column Matrix field. It’s a single row Matrix. I can get all three columns to display in the Safecracker form, including the Playa field, but I only want a single column (the Playa field) to display without the other 2 columns.

    Right now I’m using the

    {field:custom_field_name}

    input with the name of the Matrix field and that of course displays every column in the Matrix.

    How would I go about displaying just a single column?

    Thanks!

    Moved to CodeShare Corner by Moderator

  • #2 / Apr 04, 2011 3:49pm

    Sue Crocker

    26054 posts

    Hi, Andy. Mixing and matching Playa and Matrix is one of those times where this is going to be a third party issue. Do you get it to work with Safecracker out of the mix? Have you contacted Brandon to see if he’s ever tried to do this? Moving to the CodeShare Corner for additional community support.

  • #3 / Apr 04, 2011 4:22pm

    Andy J.

    58 posts

    Thanks for the response Sue. What I ended up doing was using jQuery to target and hide the unwanted Matrix columns. It seems to be working in a pinch. Just in case someone else stumbles across this thread here’s the jQuery I’m using to target a single column in a 3 column Matrix:

    $(document).ready(function() {
        $('th.matrix:nth-child(1),tr.matrix:nth-child(2)').hide();
        $('td.matrix:nth-child(2),th.matrix:nth-child(2)').hide();
        $('td.matrix:nth-child(3),th.matrix:nth-child(3)').hide();
        
    });

    The above jQuery hides the second and third columns. It also hides the label and field description cells of the first column so that only the field input (in my case a Playa drop down) is displayed.

    I might also post the question on Brandon’s site as you suggested. Thanks Sue!

  • #4 / Apr 04, 2011 8:18pm

    Sue Crocker

    26054 posts

    Glad you were able to find a solution.. first I’d heard about mixing and matching this way. 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases