title: Entering data into a grid
body: <p>A UI question: is there some consensus on the best (defined as "the one which end-users like best") or least-bad way to implement data entry into a grid?</p>
  
  <p>I have a grid, with many rows. The grid's columns contain various types of properties, which the user can enter/edit. The "types" of properties include:</p>
  
  <ul>
  <li>Free text</li>
  <li>Numbers (numeric digits)</li>
  <li>Enum value (e.g. one of 'High', 'Medium', and 'Low')</li>
  <li>Others (e.g. date, duration)</li>
  </ul>
  
  <p>The 'free text' type isn't difficult to design (so I won't ask about that), but what about the next two types?</p>
  
  <p><strong>Numeric digits</strong></p>
  
  <ul>
  <li>When using a keyboard to enter a number, would you allow free-text entry, and then run a validate method on blur? Or, monitor each key-press to restrict the data entry to digits only?</li>
  <li>How do you tell the user (on a grid, not on a form) that the syntax of the data in some column is restricted to numeric-only? What do you do if the user presses a wrong (non-numeric) key?</li>
  <li>A 'spin' or 'spinner' control is a standard Windows control; is it appropriate to try to use one on a HTML-based grid as well?</li>
  </ul>
  
  <p><strong>Enum values</strong></p>
  
  <p>For entering or editing an enum value using the mouse, I guess that popping a little context menu on a mouse click is the thing to do.</p>
  
  <ul>
  <li>An alternative is to use the <code>&lt;select&gt;</code> input control (i.e. a combo box). I guess though that having a whole column-ful of combo boxes isn't as easy to read as having a column of text value (because the combo boxes add extra non-text ink)? What do you think of usually displaying plain text, but replacing that text with a combo box when the field gets the input focus (and then removing the combo box on blur)?</li>
  <li>Would you also pop that same menu on focus, when the focus changes as a result of the keyboard (i.e. the [Tab] key) instead of a result of the mouse (i.e. a click)? In other words, should tabbing to a field result in a popup menu? Incidentally, the CSS-based popup menus that I've seen respond to the mouse but not to the keyboard (e.g. to the [Up] and [Down] arrow keys). Do you know of any Intellisense-like data entry implementation that can run in a browser?</li>
  </ul>
  
  <p><strong>For example?</strong></p>
  
  <p>I'd also be interested in seeing anything you think is an exemplary example. I'm interested in desktop UI and/or in-browser answers.</p>
  
  <hr>
  
  <p>Edit: following another question with the [data-entry] tag ("<a href="https://stackoverflow.com/questions/886191">Has anyone used Sigma Grid (Javascript-based editable data grid)?</a>"), I'm looking at the Sigma Grid example. It does a lot of things well IMO (good support for the keyboard and just-in-time selection boxes); but its support for numeric fields may be imperfect, for example if I press 'a' in a numeric cell, then sometimes it pops an alert box to tell me I'm wrong (where maybe a tool-tip would be less intrusive), and/or sometimes it leaves the cell empty (blank), erasing the 'a' and leaving nothing in place.</p>
  
  <hr>
  
  <p>Edit in reply to one of of the answers below.</p>
  
  <blockquote>
    <p>Again, however, determine WHAT the primary use of your form is going to be, and optimize for that. Data visualization or analysis has different needs than bulk entry, and satisfying keyboard users is completely different than keyboard+mouse users.</p>
  </blockquote>
  
  <p>I want the same display (i.e. a table/grid) to work well for displaying existing properties, creating new properties, and editing existing properties. I expect dozens of items (i.e. dozens of rows of data), each with only a few columns (e.g. one column of text/item description, plus 1 or more columns for 1 or more associated item properties).</p>
  
  <p>Some of the data/properties may be subjective and relative (e.g. two properties for each item are the 'priority' or 'difficulty' of each item, which is especially meaningful only when compared with other items), which is a reason why I want to display all data together on one screen: so that the end-user can compare them.</p>
  
  <p>My application is for relatively expert (not novice) computer users, but not data-entry specialists: e.g. the users are software developers, project managers, product managers, QA people, etc., but also to some extent their customers; it's running on an intranet (not public internet), nevertheless easy-and-a-pleasure-to-use and easy-and/or-intuitive-to-learn are both important.</p>
  
  <p>Also I don't see why satisfying keyboard users is completely different than keyboard+mouse users: I thought that a single solution could/should support either and/or both. </p>