Odd error when saving custom block data..

Permalink 2 users found helpful
Hi all..
I've created a small custom block that lists all files in a fileset and generates download links for them. I used the slideshow block as a template for this as the slideshow block basically produces a list of files in a fileset anyway..

The block works fine for the most part except when I'm adding the block to the page - when I click "Add" I get a blank screen with the following information on it:

{"aID":"317","arHandle":"Newsfeed","cID":"97","error":false,"bID":"249"}

the url that causes this is
index.php?cID=97&arHandle=Newsfeed&btID=52&mode=edit&ccm_token=1273072602:74cd3c9c436f112ab0ba02c2055bbc44

if I then hit "back" in the browser my block has been added successfully and is working fine.. The data has also be inserted into the database as well..

my save() is as follows
function save($data) { 
   $db = Loader::db();
   $query = "INSERT INTO btCustomFileList (bID, fsID) VALUES (".intval($this->bID) . ", " . intval($data['fsID']) . ")";
   $db->query($query);
   parent::save($args);
}


What am I doing wrong? Perhaps I just need more sleep.

Thanks all.

 
HugoRune replied on at Permalink Reply
OK - I just removed the save() function altogether because it was unnecessary (concrete does the saving for me) and I still get the same {"aID":"317","arHandle":"Newsfeed","cID":"97","error":false,"bID":"250"} coming out. Hmmmm..


*edit - tried the fix inhttp://www.concrete5.org/community/forums/chat/just-upgraded-to-5-4... (clear cache) - but no joy
HugoRune replied on at Permalink Reply
OK solved my own issue:

the problem came from the auto.js which I'd copied over from the slideshow block (doh).

So deleting auto.js fixed the issue nicely.

I am not going to give myself a gold star for solving this. I am going to stand in the corner for 10 minuted wearing the Dunce Hat instead.
jordanlev replied on at Permalink Reply
jordanlev
That strange message comes up when there is any javascript error. I consider myself a very experienced web developer, and as such I insist that you remove that Dunce Hat -- this is a terrible error message that offers no help whatsoever in tracking down the problem (it doesn't even tell you that there's a problem). So this is a fail on the part of the system, not you.

BTW, if you ever need to track down exactly what's going on with these in the future, you'll need to use Firebug and step through the code to see where it fails.
digirunt replied on at Permalink Reply
digirunt
I've just marked this thread as helpful because strangely enough I encountered the same error and the solution here fixed it.

My error was any edits to any content block caused the following error..
{"aID":"4","arHandle":"Main","cID":"1","isGlobalBlock":false,"error":false,"bID":"306"}


I had also copied the auto.js from the slideshow folder it originally resided in to the /blocks/slideshow/ folder in the root.

Not sure what was causing it but it's gone now.

Thanks for updating with your fix.
HopShip replied on at Permalink Reply
Hey Guys! I'm having the same error and this looks like the solution I need. I have little background in coding (ahem, okay, none) but can follow instructions fairly well... how would I go about removing "auto.js," where is this found? Thanks in advance, really really appreciate it.
jordanlev replied on at Permalink Reply
jordanlev
Are you having this problem with a custom block you created yourself, or with something from the marketplace? (Or one of the built-in blocks that comes with C5)?
HopShip replied on at Permalink Reply
I tried to embed a custom sign-up from MailChimp using code that they generated based on my specifications for the form. I copied this code into an html block in concrete5 and that's when the trouble happened. The MailChimp form never appeared and I started getting this error message (or something remarkably similar) ever since. Does this help? thanks!
jordanlev replied on at Permalink Reply
jordanlev
The stuff in this forum thread is referring to building your own Concrete5 block, not from pasting in code to the HTML block.

What's probably happening in your case is you got html for an entire page, but you can't do that because you're putting this mailchimp form in the middle of your C5 page that already exists -- you probably want to find different "embed code" from mailchimp -- something that is specifically for putting into a page on your site, not for an entire page itself.
Wish I could explain it better, but I don't know what terminology they are using over there.