I’ve been having a problem with a custom on_insert event but I think it really has to do with uploading an image. So I have the following for the event:
$e[“on_insert”] = array(“add_blob”, null, false);
This is now the function, so it literally does nothing:
If I run the page it works fine for an insert (no it doesn’t write to the database, it just refreshes the page), but if I try to insert an image, it crashes and breaks the session ends (users is logged in). Nothing is done other than a file was uploaded, but I think there’s an issue somewhere in the on_insert function because it does not like uploading an image. It still does upload the image to the folder, which that is fine, but then it crashes on submitting the file. This is what it looks like on a crash. It’s the before submitting and after. There’s no custom code going in at this point, as I’ve deleted everything else and just attempted to see what would happen with an empty function running:
Thank you Abu. I hope it’s a quick fix or you see something goofy that I did. Every time I used the on_insert function I get this. on_delete and on_update work flawlessly, I get no problems at all. The on_insert is the only one that crashes, and then half the time it breaks my sessions and logs the user off.
Pretty much delayed reply but I think it’s because add operation expects JSON object as return object. So if your have complete custom on_insert code (and skip grid’s insert implementation as it can be seen in your code), You also need to return a JSON object with success message from on_insert handler.
Example code mentioned in demo:
Abu Ghufran - Dev Team
Grid 4 PHP Framework
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?