2

I have a very simple Safecracker form, consisting of nothing but an Assets field. (I built it so I could quickly run through all my entries and re-assign images that have all recently been updated.)

Here's the code in question:

{exp:channel:entries channel="articles" limit="1" disable="categories|category_fields|member_data"}
{exp:safecracker channel="articles" return="/utilities/illos/" include_jquery="yes" json="no" safecracker_head="yes" class="editForm" entry_id="{entry_id}"}
{field:article_illustration}
<br><input type="submit" name="submit" value="Submit">
</tr>
{/exp:safecracker}
{/exp:channel:entries}

The Assets widget is working as expected (I can trigger the file chooser, select images, and the thumbnail shows up in the field). The problem is that then saving images does not save the new selection.

Watching events through the inspector, it looks like even though my selection is being visually added to the field, the hidden field never gets populated with the required value.

(Details: ExpressionEngine v2.5.5; Assets v1.2.2)

Updated with more info:

I've run through a few scenarios.

  • If the entry already has an image, and I save without changes, the image stays.
  • If I remove the image and save, the image is removed.
  • I added a title field, and it updates appropriately.
  • Tim, is the form accepting the submission at all or just reloading the form without data in it? For instance, if you include the title and update that, does the form submit and the title changes? If not, then there may be a cross-domain matching issue, for instance. I need to get a better visual picture of how this is failing to help out more. Thank you! -Lisa – Lisa Jan 15 '13 at 3:47
  • I suspect that you're failing on required fields. You may need to pass those at least through as hidden fields. Have you given that a try? – Lisa Jan 15 '13 at 17:49
  • I haven't got any. – Tim Jan 15 '13 at 20:25
  • What about URL title? Title is also required. You'll need to make sure you're passing through the bare minimum fields to submit the post. – Lisa Jan 15 '13 at 20:47
  • I added title and url_title fields to no effect. :( – Tim Jan 15 '13 at 21:33
1

It turns out that when I logged in and created the same form - it worked. When Tim put it into his own template, it worked.

So in this case the answer is: gremlins. His code should have worked. Possibly an invisible character, or we both missed seeing a curly quote somewhere.

But this appears to be working now!

-Lisa

| improve this answer | |
  • My pleasure! :) – Lisa Jan 17 '13 at 18:54

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.