Validation

From UG

(Difference between revisions)
Jump to: navigation, search
(Types)
 
(2 intermediate revisions not shown)
Line 11: Line 11:
(from http://en.wikipedia.org/wiki/Data_validation)
(from http://en.wikipedia.org/wiki/Data_validation)
-
== CT2 Validation Types ==
 
-
=== zk standard  ===
 
-
 
-
Typical "real-time" ZK validation:
 
-
 
-
* user enters incorrect value
 
-
* user shifts focus to another field
 
-
* (with some delay) bar will with "x" will appear next to widget stating what was wrong
 
-
 
-
=== on submit  ===
 
-
 
-
Validate only after user clicked "Submit button". Standard [[Error]] modal or [[Warning]] modal will appear.
 
-
 
-
=== status line  ===
 
-
 
-
There is a status line somewhere on the panel that real time displays the problem.
 
== After Validation: what to do with data and what to tell the user ==
== After Validation: what to do with data and what to tell the user ==
Line 58: Line 42:
For example if particular CT2 textbox should accept only integers then it can be programmed in such a way (defined as ''<intbox>'' ZK component) that if user is trying to enter characters then nothing happens - they simply do not appear on the screen.
For example if particular CT2 textbox should accept only integers then it can be programmed in such a way (defined as ''<intbox>'' ZK component) that if user is trying to enter characters then nothing happens - they simply do not appear on the screen.
 +
 +
== CT2 Validation Types ==
 +
 +
=== zk standard  ===
 +
 +
Typical "real-time" ZK validation:
 +
 +
* user enters incorrect value
 +
* user shifts focus to another field
 +
* (with some delay) bar will with "x" will appear next to widget stating what was wrong
 +
 +
=== on submit  ===
 +
 +
Validate only after user clicked "Submit button". Standard [[CT2 Error]] modal or [[CT2 Warning]] modal will appear.
 +
 +
=== status line  ===
 +
 +
There is a status line somewhere on the panel that real time displays the problem.
 +
 +
== See Also ==
 +
 +
* http://docs.zkoss.org/wiki/Form_and_Inputs#Constraints

Current revision as of 19:21, 13 February 2010


This relates to how / when we validate type/format.

Contents

[edit] Definition

Data validation is the process of ensuring that a program operates on clean, correct and useful data.

The simplest data validation verifies that the characters provided come from a valid set. For example, telephone numbers should include the digits and possibly the characters +, -, (, and ) (plus, minus, and parentheses). A more sophisticated data validation routine would check to see the user had entered a valid country code, i.e., that the number of digits entered matched the convention for the country or area specified.

(from http://en.wikipedia.org/wiki/Data_validation)


[edit] After Validation: what to do with data and what to tell the user

Next step after a validation is to make a decisions about:

  • what to do with data that fails validation?
  • how to communnicate with a user about it and what are the possible workflows

Normally validation is done before data is stored into database or into memory to be used later.

In CT2 there are several types of decisions:

  • ignore data
  • modify data so that it pass validation (example: cut the end of the string to satisfy max)
  • block the flow until user fixes the data


In all cases above you could:

  • say nothing to the user (bad idea)
  • display a message and give a choice
  • display a message and give no choice

See also CT2 Warning and CT2 Error

[edit] Another way of enforcing user to enter data in correct type / format: Blocking the Input

In CT2 and ZK there is another way of enforcing user to enter data in correct type / format.

For example if particular CT2 textbox should accept only integers then it can be programmed in such a way (defined as <intbox> ZK component) that if user is trying to enter characters then nothing happens - they simply do not appear on the screen.

[edit] CT2 Validation Types

[edit] zk standard

Typical "real-time" ZK validation:

  • user enters incorrect value
  • user shifts focus to another field
  • (with some delay) bar will with "x" will appear next to widget stating what was wrong

[edit] on submit

Validate only after user clicked "Submit button". Standard CT2 Error modal or CT2 Warning modal will appear.

[edit] status line

There is a status line somewhere on the panel that real time displays the problem.

[edit] See Also

Personal tools