The Blog

Usability improvement for MT

This web site is hosted on the very slow server and the consequence is that the rebuilding of files takes forever, sometimes up to 1 minute. :’(

Side-effect of this is that, when you submit a comment, it appears that nothing is happening (except the upper right browser icon is rotating) so you naturally click again and again and it sometimes posts the same comment several times. I’m not able to repeat that (which puzzles me), but I have seen it happen (and spent time deleting identical comments).

So, to save my self some time, I changed MT comment handling script. I added this into form tags on entry comment template (as well as on comment listing, preview and error templates):

onsubmit="return SubmitComment(this)"

and this is the SubmitComment function:

function SubmitComment(oForm) {
  if (oForm.submitClicked) {
    alert("Form is submitted, processing »
       will take a bit (it is a slow server :( )");
    return false;
  }
  oForm.submitClicked = true;
  if (oForm.bakecookie)
    if (oForm.bakecookie[0].checked)
      rememberMe(oForm);
  return true;
}

It is very simple DOM trick: property submitClicked is added to form object and later on checked, so if you click more than once you’ll be notified and that second (third etc.) submit will be canceled.
bakecookie thing is from original MT build.

Banca

Banca

Beautiful and functional currency converter, supports just about any currency in the world.

Go Couch to 5k

Go Couch to 5k

The most popular starter running program in beautiful feature-rich app (GPS tracking, charts, detailed history etc)

Quickie to do

Quickie to do

The fastest short-term task-list / check-list app on the App Store. Really.

Guerrilla Cardio

Guerrilla Cardio

The most challenging high-impulse interval training in the world.

Run Mate

Run Mate

A versatile running coach app, with unlimited number of running programs. Perfect for casual runners.

3 Comments

Feel free to chime in, looking forward to it. Leave a Comment

  1. Doeke Zanstra says:

    The downside of this method is when a http request is lost on internet (from the browser perspective, the request times out, it does happen sometimes), the user can’t resubmit the form.

    Copying the data, reload the page, paste the data and submit is the only option for that situation.

    One way of addressing that isue would be starting a timer, but the request can’t be cancelled as far as I know. Do you have any ideas?

  2. aleck says:

    Good point.

    Problem is how to reliably detect that request has failed? Nothing that comes to mind… If we could detect that, than it’s easy to reset the property.

    Other solution would be to place another button like “Resubmit”, which can be hidden until the user clicks on the Submit and something like 5-10s pass. If request don’t pass through in that time, function will execute and show that button.

    Or better yet, the message that pops up can contains something like this:
    “Form is submitted, processing will take a bit (it is a slow server :( ).\n\nIf in 10s you are still waiting for submit to finish, try resubmiting again.”

    On form submit you do setTimeout(“enable()”, 8000) and let it work. You can even track down the number of passed seconds and display appropriate message to the user. It’s all about your decision — is it worthwhile or is it overkill.

  3. I suggest a little more elegant method. You can disable the “Submit Comment” button once clicked. Then, you can put in the text of the button something like “If page don’t reload press F5”.

Leave a Comment

Add your comment here, just please be civilized and stay on topic.