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 and safecracker

March 27, 2012 12:03pm

Subscribe [1]
  • #1 / Mar 27, 2012 12:03pm

    mark59

    88 posts

    The only example in the expressionengine documentation for using the safecracker_file field type inside of a safecracker form is the following

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

    If I am not using the custom fields loop and wish to refer to my safecracker_file field type directly for it to appear in my form what is the code snippet I need.

    I have more than one custom field containing this file type and I only want this one displayed. I do not want to loop around all my fields but reference the field directly.

  • #2 / Mar 28, 2012 3:35pm

    Dan Decker

    7338 posts

    Hi mark59,

    Sure thing!

    {field:my_field_name}

    Use the short name of the SafeCracker File field in place of “my_field_name”. You can use that patter to display any field from the channel the SafeCracker is posting to.

    Cheers,

  • #3 / Mar 28, 2012 3:43pm

    mark59

    88 posts

    Dan, Many Thanks

    That worked. I did find this out myself eariler on today after many hours and I cannot even remember how I came across it.

    So could someone please add this {field:my_field_name} to the safecracker documentation and provide a small example code segment for a template as well. To help others. I did not see this mentioned in the safecracker documentation - but if I missed it apologies.

    Kind Regards ... Mark

  • #4 / Mar 28, 2012 3:47pm

    mark59

    88 posts

    As a note I also used this method on a File field (not just a safecracker_file as before).

    {field:my_file_field}

    And while the image thumbnail showed up and the remove file/add file links appear - the two links do nothing - so I am unable to change the image. Help.

  • #5 / Apr 02, 2012 4:43pm

    Dan Decker

    7338 posts

    Hi mark59,

    In either of your instances, have you made sure to include the SafeCracker assets in your SafeCracker template?

    Place this code in the html head of the SafeCracker template:

    <link href="{path=css/_ee_saef_css}" type="text/css" rel="stylesheet" media="screen">

    If you include the SC assets, do the file fields behave as expected?

    Cheers,

  • #6 / Apr 03, 2012 6:32am

    mark59

    88 posts

    Dan, yes I have

    <link href="{path=css/_ee_saef_css}" type="text/css" rel="stylesheet" media="screen">

    is already in my template, and the remove/add file links do not work.


    I do not see any example of the native File type referenced under the Safecracker documentation.


    Can the File type be used under Safecracker?

  • #7 / Apr 05, 2012 5:29pm

    Dan Decker

    7338 posts

    Hi mark59,

    I do not see any example of the native File type referenced under the Safecracker documentation.

    Can the File type be used under Safecracker?

    I have never had success trying to use it. So I’ve just started using SafeCracker File in channels that I’m going to use with SafeCracker.

    Is there anything else I can assist you with?

    Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases