rjmcb
rjmcb

Reputation: 3745

Save on form submit versus save on keypress

I'm using PHP as my scripting language and mySQL as my database. Im wondering if saving into database on form submit is better than saving on every keypress. Which is better in terms of usability/ux and in performance?

Upvotes: 0

Views: 185

Answers (2)

zakelfassi
zakelfassi

Reputation: 2966

Saving on keypress is definitely a very bad idea ! A typical form with 10 fields, will require at least 100 calls to the database. Not very optimal. Even from a UX point of view; But you can create a setTimeout for saving the user input, say, every 30sec (the setTimeout will be initialized after the first field has been changed, for example).

Upvotes: 1

Quentin
Quentin

Reputation: 944020

Saving on every keypress means:

  1. You'll need a server capable of handling more requests
  2. You'll need smarter logic then every key press as most people can press keys faster than most connections can round trip an HTTP request. Possibly something like "Every 30 seconds, but only if the data has been changed, but delayed until a response is received for the last request (or it times out)".

Upvotes: 2

Related Questions