AjaxFileRemoval is not working
|Priority:||Should have||Due date:|
|Assignee:||Reinhard Führicht||% Done:||
|Target version:||Stable v1.0|
AjaxFileRemoval is not working for me. Ajax response is empty so it looks ok, but after reload the file is back. I think this is because of the session handling change. The ajax call doesn't find the files in the session.
I had no time to debug this yet, just switched to enableFileRemoval.
Is this working on other systems with current trunk?
|related to Formhandler - Bug #7912: Dispatcher handleAjax() only if needed||Resolved||2010-05-26|
Updated by Reinhard Führicht about 3 years ago
Joh. Feustel wrote:
I think this is because of the session handling change. The ajax call doesn't find the files in the session.
Exactly. As the files and all other session values are now stored using a random hash, the ajax call is unable to find out where the files are stored.
I used a workaround in Tx_Formhandler_Utils_AjaxValidate.php. Basically I just stored the randomID in $_SESSION to be accessible, but I am not really proud of this solution either.
Anybody has a better solution?
Updated by Joh. Feustel almost 3 years ago
- File formhandler_ajaxhandler_randomID.diff added
I think the ajax handler could add the randomID as GET parameter to the request url. Thus Tx_Formhandler_Utils_AjaxValidate can retrieve the session data.
With the current approach using $_SESSION['randomID'] we will have problems with various forms submitted in the same session. I know this will not happen very often but it could ;-) See attached patch which works for me in a quick test.
Regarding xajax I only see the workaround of having the randomID in a dummy parameter given to the called php function (here removeUploadedFile()) which is sended by xajax and could be fetched by the controller. But this is still a workaround. Maybe we should drop xajax and move Tx_Formhandler_Utils_AjaxValidate to Tx_Formhandler_Controller_Ajax and make it handle the file removal too.
What do you think?
Updated by Reinhard Führicht almost 3 years ago
Either Controller_Ajax or let the AjaxHandler take care of it. Either way, I agree to get rid of xajax and create something suitable for any JS library.
Could you come up with a patch or should I take a look?
Updated by Reinhard Führicht over 2 years ago
- Status changed from New to Resolved
- Assignee set to Reinhard Führicht
- Target version set to Stable v1.0
- % Done changed from 0 to 100
I committed changes to trunk.
xajax will not be used in Formhandler anymore.
The AJAX file removal will now be handled by the AjaxHandler. It seems to work fine with AjaxHandler_JQuery.
I you find any problems, please open a new issue.