1

I'm trying to use multiple Safecracker File fields in a Safecracker form.

I tried to use one matrix field with one column - the SC File field. On submission, no rows or files were added.

I thought it would be easier to take Matrix out of the equation so I changed it to 3 separate SC File fields. Now only the first field gets uploaded. I don't see any errors (tried logged in as Super Admin and Non-Super Admin)

My template code is very simple.

{exp:safecracker ...}
  {custom_fields}
    {if safecracker_file}
      {display_field}
    {/if} 
  {/custom_fields}
{/exp:safecracker}

The fields are output correctly, each have unique names.
The following is what is output for each field:

<div class="safecracker_file_set">
  <div class="safecracker_file_hidden">
    <input type="hidden" name="CUSTOM_FIELD_NAME_3_hidden" value="">
  </div>
  <div class="safecracker_file_placeholder_input">
    <input type="hidden" name="CUSTOM_FIELD_NAME" value="NULL">
  </div>
  <div class="safecracker_file_input">
    <input type="file" name="CUSTOM_FIELD_NAME" value="">
  </div>
</div>

Running 2.5.3, but I don't see anything in the changelog that directly mentions something like this. I'd realllllly like to avoid upgrading.

2
  • Do the three Safecracker File fields all have unique names when you inspect the source code of the generated page? – Derek Hogue Feb 11 '13 at 15:17
  • Yes, they do. I'll update my question to show the code that's generated. – Jason Varga Feb 11 '13 at 15:19
1

My custom fields were named as _x with underscores:

{attachment}, {attachment_2}, {attachment_3}

Removing the underscores fixed the problem:

{attachment}, {attachment2}, {attachment3}.

This was verified by EllisLab as a bug and a bug report has been filed.

0

FWIW, I have a similar setup that is working correctly, but it's on a 2.5.2 install. Code is identical to yours - is it possible there's a js conflict?

1
  • Hmm I don't see any JS errors when loading the page or submitting it. – Jason Varga Feb 22 '13 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.