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 not updating

September 24, 2011 9:37am

Subscribe [5]
  • #1 / Sep 24, 2011 9:37am

    Oliver Ker

    7 posts

    Hi,

    I have been trying to get safecracker file to work with in zoo visitor but It doesn’t seem to work in a form on its own.

    I am using

    {exp:safecracker channel="member" return="member/edit/success" entry_id="{zoo_visitor_id}"}
    <div>
    <label for="member_avatar">{label:member_avatar}</label>
    <em>{instructions:member_avatar}</em>
    {field:member_avatar}
    </div>
    
    <input type="submit" value="Submit" />
    
    
    {/exp:safecracker}

    which loads the current image that is there, (it did let me upload a new image when nothing was there) but when trying to upload a new image and click the cross on the top left, nothing happens.

    Im lost as there is nothing else on the page.

    Thanks

  • #2 / Sep 26, 2011 9:52am

    Sue Crocker

    26054 posts

    Hi, Oliver.

    If you take zoo visitor out of the equation, does the problem still happen?

  • #3 / Sep 26, 2011 3:27pm

    Oliver Ker

    7 posts

    yep, same problem, seems like a javascript error?
    Even in the main admin It doesn’t work 100%, I can remove the image, but have to save the entry and go back into add a new picture.

  • #4 / Sep 27, 2011 11:54am

    Mark Bowen

    12637 posts

    Hi Oliver,

    When you say you have nothing else on that template is that literally all you have, that code above?

    I only ask as you might need to add in the SAEF stylesheet in order for things to work a little better.

    You would also need a very simple html layout too in order to add that in of course.

    Also you definitely don’t have safecracker_head=“no” in your Safecracker form as a parameter do you?

    If not then can you see some Javascript being added to the source output of that page and does the image have a border around it with the name of the file beneath it or not?

    Does that help?

    Mark

  • #5 / Sep 27, 2011 12:12pm

    Oliver Ker

    7 posts

    Yep, this is the exact code on that page

    <html>
    <link href="{path=css/_ee_saef_css}" type="text/css" rel="stylesheet" media="screen" />
    
    <body>
    
     
    {exp:safecracker channel="member" return="member/edit/success" entry_id="9"}
    <div>
    <label for="member_avatar">{label:member_avatar}</label>
    <em>{instructions:member_avatar}</em>
    {field:member_avatar}
    </div>
    
    <input type="submit" value="Submit" />
    
    
    {/exp:safecracker}
    
    
    </body>
    </html>

    The grey box appears but nothing happens when I click on the cross - tried uploading a text file of view source but wouldn’t so here is the code http://huddsdigitals.com/safecracker-file.rtf

     

  • #6 / Sep 27, 2011 12:55pm

    Mark Bowen

    12637 posts

    Hi Oliver,

    If you try out the code from the documentation does that work for you?

    When you said above that in the admin you can remove the image but not add a new image until you’ve saved the entry and gone back in to edit it again could you possibly show a screenshot or explain what does happen once you remove one from an entry?

    When I click the cross on the top left corner of the image it disappears and then a link where it used to be comes up which says Undo Remove. Do you not get that then?

    Thanks,

    Mark

  • #7 / Sep 27, 2011 1:31pm

    Oliver Ker

    7 posts

    Other fields do work in the safecracker loop area, so not sure by what you mean about the

    If you try out the code from the documentation does that work for you?

    There isn’t really a specific safecracker_file example - im asuming the code im using is ok in some aspects?

    I have upload 3 images.
    Before (in the admin)
    After I click the cross (in admin) and the choose file is greyd out
    And in browser shot which nothing happens when I click the cross just the # appears in the url

    Thanks

  • #8 / Sep 29, 2011 10:28am

    Mark Bowen

    12637 posts

    Hi Oliver,

    Can I ask which version of ExpressionEngine you are running on this site please?

    With respect to the code in the documentation yes sorry that isn’t probably laid out quite as well as it could be but could you try this code in a template please and nothing else :

    {exp:safecracker channel="member" return="member/edit/success" entry_id="9"}
    
    
    {custom_fields}
    
    <label for="{field_name}">{if required}* {/if}{field_label}</label>
     
     {field_instructions}
     {formatting_buttons}
    
     {if safecracker_file}
      {display_field}
     {/if}
     
    {/custom_fields}
    
    <input type="submit" value="Submit" />
    
    {/exp:safecracker}

    Let’s see how that goes for you.

    Thanks,

    Mark

     

  • #9 / Sep 29, 2011 10:38am

    Oliver Ker

    7 posts

    Hi Im using v2.2.1
    That code does the same, it shows the image, it flashed the choose file and remove file links, but when you click the cross, nothing happens.

  • #10 / Sep 30, 2011 8:32am

    DanL

    56 posts

    I get the same in v2.2.2 - the file input form flashes into view then is gone, hidden by some embedded JS somewhere on the rendered page (?).  All I’m left with is a thumbnail, “Remove File” and “Add File” links which do nothing when clicked (I guess they are supposed to trigger a JS event?).

    I’m just using {field:field_name} to deploy the field into the form.

  • #11 / Oct 02, 2011 2:27pm

    Kevin Smith

    4784 posts

    Oliver and Dan,

    It sounds to me like you both may have an outdated version of SafeCracker and/or SafeCracker File in your installations. Could you both make sure to upload again the appropriate version (the one that came with your download of EE) of the module to your system/expressionengine/modules and the fieldtype to system/expressionengine/third_party?

    If you don’t have the zipped download of the version of EE that you’re site’s currently running on, then download the latest version and go through the full update process to make sure your site is running on the latest version EE.

  • #12 / Oct 03, 2011 4:39am

    DanL

    56 posts

    Hi Kevin,

    As I already said, I’m running 2.2.2 - so how can I possible be running outdated versions of any core EE software?  I don’t really understand how re-copying the same files will make any difference…

    Cheers
    Dan

  • #13 / Oct 03, 2011 6:02am

    DanL

    56 posts

    Ok, I managed to resolve this in the end.

    First I tried:

    {custom_fields}
    {if file}
        {display_field}
    {/if}
    {/custom_fields}

    ...this worked, the Add/Remove links worked, and the file browser pop-up was displayed - HOWEVER, I found the “Upload” button to be completely ineffective, making the whole thing pointless as no new images could be uploaded.

    The answer (for me) was to change the field type from “File” to “Safecracker File”, then amend the template:

    {custom_fields}
    {if safecracker_file}
        {display_field}
    {/if}
    {/custom_fields}

    The output is different (no EE file browser) but I was able to remove and add new images to the form and save correctly.

    Obviously the “Upload File” button being non-usable is a different issue; perhaps related to a similar bug in the CP where the upload button doesn’t function correctly?

  • #14 / Oct 03, 2011 12:16pm

    Mark Bowen

    12637 posts

    @Dan,

    Yep I’ve noticed this exact same behaviour myself regarding using a File field as opposed to the Safecracker File field and did mention it internally.

    Glad you have it working now with the Safecracker field though. With regards to the File field then hopefully this will be fixed up in a new release soon.

    @Oliver,

    Does this work for yourself if you try using a Safecracker File field instead perhaps?

    Thanks,

    Mark

  • #15 / Oct 03, 2011 1:39pm

    DanL

    56 posts

    Cheers Mark, good to know it’s not something I was doing wrong at least. I actually find the Safecracker method preferable so am happy 😊

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

ExpressionEngine News!

#eecms, #events, #releases