Form encoding

Hello,

I have a form that invites userid, password and some other information. When ‘send’ is pressed, the form details are transmitted to the server thus:

click:function(){webix.send(“http://intel/index.eui”, $$(“log_form”).getValues(), “POST”)}}

It works fine, except that I have changed from Mac OS X to Linux, and the data are now received as URI-Encoded. This leads to password failures. If the actual password is ‘Why?’ the server will receive, and try to compare, ‘Why%3F’. That’s a fail.

Is there a way to tell webix.send() to use plain text encoding? I can see examples where that is done with ajax form submission, but not with web.send().

Thanks,

Craig

Any thoughts?

Hi @Bellthorpe ,

webix.send creates and submits a hidden HTML form in the background without changing the values. Both can be compared here: Code Snippet

Default enctype of the form is application/x-www-form-urlencoded, so by default, the form always sends parameters with URI encoding (that is usually handled by the backend without any issues). Formatting can be observed by inspecting request parameters.

Unfortunately, I’m not sure what can cause the difference on Linux: if the server always treats the parameters equally, perhaps the issue is browser-related.

As webix.send does not allow changing the enctype before sending data (in addition to URL/values, only method and target are available as parameters, other settings are default), I would suggest three possible solutions:

  • create a more specific encoding verification on the server-side,
  • use webix.ajax().post(), which will encode the JSON explicitly to the same format,
  • send a custom xhr to send the data with alternative encoding. The “text/plain” enctype won’t escape any characters.

Great, thanks for the clear and comprehensive response Listopad.