I am currently debugging the HTML Form entry module to see how the image upload works. When I try to upload the image via the new GUI html form, there are no errors shown regarding the upload in the developer tools.
I assume it is a problem with there server communication.
It would be really helpful if anyone can guide me on the flow so I could debug this efficiently to check how the upload works.
Can you simplify my work a bit by doing for me as much as you can. For instance, if i need to first read a wiki page to create a form, it would help if you do it and simply attach it. Does it make sense?
Generally, when you need help, make it as easy and simple as possible for people to get in and help.
It seems like i have narrowed down the reason for the problem. The new HTMLFormUI module uses jQuery AJAX to submit forms, where as the older one used direct form submits using http POST requests.
The AJAX form submission logic is implemented in htmlForm.js script. This uses jQuery to perform a post request when the submit button is pressed ( some additional stuff like pre/post submit calls to functions are also done but it is not that important for our case).
The solution that I would like to suggest is to use jQuery Form plugin as described in the link above in our module and use it’s features in the htmlform.js script.
@akshika47, if you read the solutions below the accepted answer on the stackoverflow post (and the comments on the accepted answer) it seems that HTML5 does actually allow you to upload form data without an extra jquery plugin.
I suggest you try one of those options (e.g. FormData).
To upload files using ajax we have to use XHR2 file uploads.I tried performing a XHR2 request
to upload the file using the new UI and the backend gives this error : http://pastebin.com/C9jh8t5y
I think that the backend doesn’t support xhr2 requests?
it failed to handle requests that included files and and those that didn’t
What should I do to fix this error? I assume we need to fix the backend for this matter.
@akshika47, going forwards I’m going to have to ask you please spend more time on posting well-written questions, or I will not continue answering them.
In this example you should have included at least:
a pointer to the code you are running (e.g. your module on github) with a specific pointer to the piece of code that matters.
the specific thing you did to invoke this error message (in this case, what screen were you posting from, what URL did you submit to, and perhaps what the content of that submission looks like)
Looking at the error message, I see
A user context must first be passed to setUserContext()…
which implies that maybe you’re just not logged in when making this submission. But if you provided other info, then that could help point to a different problem.