tags:

views:

90

answers:

5

In what order should I perform Validation & Confirmation?

Meaning, do I first ask the user to confirm save or first validate the form?

Consider two cases, in the first - validation is really quick, in the second - validation can take a couple of seconds. Do you change the order then?

Edit: The button doesn't act as "save" but performs a "delete" so confirmation is necessary.

+1  A: 

If possible, don't create an extra step ("save now y/n") - provide undo instead ("document saved, now validating. [link]Oops, I didn't want save, undo that[/link]"). That way, the user will have a way to "not save", while you validate in the background.

If you can't save w/o validation, put the user's submitted data to a temp location (show "now checking your data"), validate, and if it passes validation, save in the background, else alert user.

Piskvor
Only I can't save when the form doesn't validate. So I can't first perform the save and then validate.
Faruz
That's fine as long you allow the user to save invalid data.
RichardOD
A: 

Do it in this order:

  • Quick validation
  • Confirm save
  • Slow validation

This way, you don't waste your users time and most problems will be caught before the user is asked to click somewhere.

Aaron Digulla
The problem with validating first, is the following: (Consider this scenario):1. User tries to save. Got an error.2. User fixes error, tries to save and then asked "Do you want to save?"3. User presses "yes", and get an error...It becomes a mess, no?
Faruz
+4  A: 

Validate first. If you have a cycle of errors, this reduce the number of dialogs by a large amount.

Consider save then validate, with 3 rounds of errors:

Save confirm --> Validate (fails), Save confirm --> Validate (fails), Save confirm --> Validate (fails) --> Save (passes).

That's 7 dialogs. Now with validate:

Validate (fails) --> Validate (fails) --> Validate (fails) --> Save (passes).

That's 4 dialogs.

Try to optimise your validation routine! Also is save a dangerous operation? Do you really need a save confirm? You could have a history mechanism instead (a bit like SO) and eliminate the save dialog completely.

Another option is allow the user to save invalid data, which may or may not be workable depending on your solution.

If you are worried about ruining your DB design by saving invalid data (some people do this by allowing columns to be nullable, when they shouldn't be), you can always persist the state temporarily to a BLOB.

RichardOD
Validation is more or less optimized. I'm looking at a worst case scenario of 2 seconds (When the server is busy with daily routines (DB Backups etc.). Confirmation is required, it's not a "save" button, but a "delete" button. Great answer though - convinced me.
Faruz
+3  A: 

I recently went to the StackOverflow DevDay in London, and there was a very good talk by Joel Spolsky about the fact that user's don't like being prompted to make decisions. He used the example that you often get repeated prompts in software to confirm that you do want to do, what you've just asked the software to do.

There was an example for Amazon's (I think) 1-click purchase button, where it originally required multiple clicks to buy a product - 1 click on the button, then another to confirm the purchase. It finally become a true 1-click purchase button as they optimised for the majority. Most people that click the button don't want to be prompted to confirm. For the minority that do make a mistake and want to undo it, there's a route whereby they can then go and cancel it afterwards.

So ask yourself the question: do I really need to prompt the user to confirm before saving? If they clicked a Save button, then they've made the choice to save.

AdaTheDev
+1  A: 

Validation for webapps is always a bit different. Generally you'd have such a flow

  • validate instantly using JavaScript on the client side
  • the user presses "Save"
  • perform a more intense / sophisticated validation on the server side and report back problems in case

In your specific example you mentioned (the save operation) I wouldn't prompt any confirmation. I mean, it's a save operation and there should be a corresponding delete operation, too. So for save no prompt is needed in my case. I would really prompt just in cases where the user cannot go back like when deleting an entry.

Juri