Dropping AJAX in TDO Mini Forms v0.7

Do you really want or need AJAX in TDO Mini Forms?

The only reason I used ajax originally in TDO Mini Forms plugin was to get around the problem of a “double submit”, where once you’ve submitted your post and then you reload the page, the post gets submitted twice. I also thought it would be the only way to do a “preview”. However, as I’m doing my code refactoring for the next version of the plugin, I built up the form normally using POST and properly corrected the double submit issue. It also now also does preview and validation, with ease. Also POST automatically solves problems I’ve had with AJAX that I’ve had to hack fixes for such as long posts and foreign characters.

It’s just that with the new implementation of the form, where it is built up dynamically from “widgets” chosen by the admin, I’m left with a problem. With POST, all the form variables are passed to the backend PHP and these variables are then thrown back to the widgets to process. With AJAX, how do I get the variables from the form without knowing in advance what they are called and serialise them into some format in javascript that can be processed by PHP? I’ve looked around on line and I’ve found no ready solutions online. Also, file uploading, a feature constantly requested, is easy enough to do with POST but complicated to do with AJAX.

From the user perspective, there isn’t much difference between AJAX and POST for the form. In one case, the form reloads the page, with the other it uses some javascript to updated a field. AJAX makes it difficult to do file uploading and introduced problems in the past.

Anyway, the hooks are there in the code for AJAX so if I can ever get over the hurdle I may implement AJAX for future versions of TDO Mini Forms.

Also, work is progressing nicely on the latest version. I have the widgets working now. There is a nice drag and drop UI to allow admins to easily organise their form. It wouldn’t take much effort now to create a “edit form” as well, if I so wished, but perhaps thats something for a later version of tdomf. Widgets will allow me (and potentially others) to create all those little features people keep requesting such as a “file uploading”, “custom fields”, “drop-down category selection”, “I agree checkboxes” etc. and allow people to sort the order of these elements in the form. I’m really looking forward to getting tdomf out and seeing how people take to it.

(I’m keeping comments closed on this post. Please you the forum to discuss this post).

Related Posts: