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.

Safecracker File Fieldtype within Matrix Field

July 12, 2011 4:14am

Subscribe [3]
  • #1 / Jul 12, 2011 4:14am

    1px Solid

    28 posts

    Hello team,

    I’m trying to get the Safecracker File Fieldtype working within Matrix.

    Adding one image is fine. However trying to add a second image results in the attached…

    Any help would be hugely appreciated 😊

    I’m running EE v2.13, Safecracker 2.0 and Matrix 2.2.1 (all the latest)

    Cheers

  • #2 / Jul 12, 2011 3:57pm

    Sue Crocker

    26054 posts

    Hi, 1px Solid.

    While this may be the most recent version of Matrix, you aren’t on the most recent version of EE. I’d suggest upgrading to EE 2.2.1. Can you give that a try? I’d test locally first.

  • #3 / Jul 14, 2011 1:57am

    1px Solid

    28 posts

    Thanks for the help Sue!

    Now running 2.2.1. This fixed the initial problem, but presented a new one, albeit a smaller, quirkier one.

    It seems now the ‘x’ icon to the top left of the thumbnails no longer removes the image.

    If you click it, nothing happens.

  • #4 / Jul 14, 2011 11:27pm

    Lisa Wess

    20502 posts

    Hi, 1px Solid -

    That is specific to Matrix, it looks like? Have you followed up with Pixel and Tonic?

    If you upload using a SafeCracker File field on its own (not as part of Matrix) can you remove the image then?

    Let us know, thank you.

  • #5 / Jul 17, 2011 10:22pm

    1px Solid

    28 posts

    It could be a SafeCraker issue. Looking at the html output for the [x] button…

    <a href="#class=safecracker_file_remove_button"></a>

    I searched for that class name and the click event is defined within expressionengine/third_party/safecracker_file/ft.safecracker_file.php

    via

    $this->EE->javascript->output('$(".safecracker_file_remove_button").live("click",function(){fs=$(this).parents(".safecracker_file_set");fs.find(".safecracker_file_thumb, .safecracker_file_input, .safecracker_file_existing").toggle();fs.find(".safecracker_file_input input").attr("disabled","");fs.find(".safecracker_file_remove input").click();h=fs.find(".safecracker_file_hidden input").val();p=(h&&$(this).is(":checked"))?h:"NULL";fs.find(".safecracker_file_placeholder_input input").val(p);return false;});');

    Any help would be greatly appreciated.

  • #6 / Jul 17, 2011 10:47pm

    1px Solid

    28 posts

    It looks like the above javascript isn’t being output anywhere and therefore would explain why the click doesn’t do anything.

  • #7 / Jul 18, 2011 11:48am

    Lisa Wess

    20502 posts

    Hi, 1px Solid -

    Did you apply the hotfix to your installation?  Please try that and see if it helps.  Also please let us know what Admin > Output and Debugging says for Debug.  Is it set to 1, or 2?

    Thanks!

  • #8 / Dec 08, 2011 2:18am

    1px Solid

    28 posts

    Hi Lisa,

    A long delayed followup on this.

    1. My debug is set to 1
    2. The problem always happens when adding a ‘new’ image. After a new image is added, which creates a blank row, I can edit that row with a new image, and it works.

    Any ideas on what else I can try? I realise it can be hard to debug when you can’t see what’s happening. Let me know if you want a temporary login.

  • #9 / Dec 08, 2011 4:39pm

    Lisa Wess

    20502 posts

    Hey 1px Solid -

    It has been a long time since this thread started.  What version of EE are you on now?  If you’re not on 2.3.1 that’s definitely the next step.

    With updating Matrix being the step immediately following getting on 2.3.1. =)

  • #10 / Dec 08, 2011 8:29pm

    1px Solid

    28 posts

    Hi Lisa,

    I’m on the following:

    - Expression Engine 2.3.1 (latest)
    - Matrix 2.2.3.2 (latest)
    - SafeCracker File 2.1 (latest)

    The issue is still happening and is easy to replicate…

    1. Load the page with a safecracker form containing a Matrix field
    2. Add a ‘new row’
    3. Select a local image
    4. Submit
    5. The page then refreshes with an empty (missing image) row. Looking at my FTP no file is actually uploaded
    —-
    6. I can then remove the missing image
    7. Select the same local image
    8. Upload
    8. The page then refreshes with the image

    So it only happens with new rows.

    This is the code I’m using for safecracker.

    {exp:safecracker channel="faux_member_photos" entry_id="{embed:entry_id}" author_id="{logged_in_member_id}" return="members/photos" limit="1"}
      <input type="hidden" name="title" id="title" value="Photos-{member_id}" size="50" maxlength="100" />
    
      <label>Images</label>
      {field:member_photos}
     
      <input type="submit" value="Submit" id="submit_button" name="submit" class="submit cta" />
    {/exp:safecracker}

    Screenshot attached for reference of blank output after initial upload.

     

  • #11 / Dec 12, 2011 2:39pm

    Kevin Smith

    4784 posts

    Hey 1px Solid,

    Could you try that same form with a SafeCracker File field as a stand-alone field (i.e. not part of Matrix)? I suspect that there may be a problem with Matrix and SC File, but we need to narrow down the problem before trying to fix it.

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

ExpressionEngine News!

#eecms, #events, #releases