← Back to team overview

mahara-contributors team mailing list archive

[Bug 1216764] Re: JSON error when using drop zone

 

Not quite, the problem is there are certain form fields (which can vary
depending where the fileuploader is included) that are used to cancel
the file upload process. So when dropzone slurps up all the form field
from it's enveloping form it gets fields like '[whatever]_cancel' that
it doesn't want.

In the php code there are things like if('cancel') are higher up in the
hierarchy of things to do and when a cancel is encountered the normal
response from pieforms is to return the page to replace itself, which is
all HTML.  So not an error, just normal way of things.

However when the point of actually trying to upload a file is reached
the response back is in JSON (either success or fail), which is what
dropzone is expecting, and not the HTML one.

if it gets the HTML response it throws the 'SyntaxError: JSON.parse:
unexpected character' - that tells me that it is receiving a field (like
cancel) that it shouldn't.

These should all be ironed out now. But if the error occurs again the
first thing is to do a console.log() on the form fields that
filedropzone.js is sending and see if any of those are not meant to be
sent on a fileupload submit.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contrib members
https://bugs.launchpad.net/bugs/1216764

Title:
  JSON error when using drop zone

Status in Mahara ePortfolio:
  In Progress

Bug description:
  latest Mahara 1.8.0dev

  When adding a file via drag and drop to a journal entry, I get
  "SyntaxError: JSON.parse: unexpected character".

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1216764/+subscriptions


References