Website Form Acrobatics

form-acrobatics1 Occasionally a client will ask for something absurd…

“I want this to submit the file, only if the rest of this goes through smoothly.” – Client 1

Taking this excerpt I would typically submit the file and just not move it out of the temp directory, so it would effectively not be available to the user and the web server would drop the file from its history without any real impact visible to the user…

No.

Occasionally a client will ask for something absurd…

“There’s no use submitting the file if there isn’t already a ticket created. Files can be pretty large…” – Client 2

After going back and forth, it comes out that there is flow to worry about, and that the system is going to be a pain. We turned to AJAX and did some acrobatics, but the end result looks something like this…

$("form:first").post('newReq.php', {...},
function(data)
{
	$(this).submit();
});

Currently I’ve been reviving my love for jQuery and making my days so much more realistic. I have always found the library to be superior to most everything else in the world. There is something fantastic about being able to just let my hair down and not need to bother worrying about how to handle things in raw AJAX/JS/Multiple forms or worse yet – having to tell a client i cant accomplish something.

What kind of crime is that you may ask – Its a terrible one.