From c644128fdd49a47d791240e0e38b54cd22412bc5 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Wed, 4 Jul 2007 23:54:32 +0000 Subject: fixed validation errors... about a zillion of em. --- user_guide/libraries/validation.html | 138 ++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 68 deletions(-) (limited to 'user_guide/libraries/validation.html') diff --git a/user_guide/libraries/validation.html b/user_guide/libraries/validation.html index 8ba45ba4b..cd239ea40 100644 --- a/user_guide/libraries/validation.html +++ b/user_guide/libraries/validation.html @@ -77,7 +77,7 @@ Form Validation
  • Check for required data.
  • Verify that the data is of the correct type, and meets the correct criteria. (For example, if a username is submitted it must be validated to contain only permitted characters. It must be of a minimum length, -and not exceed a maximum length. The username can't be someone else's existing username, or perhaps even a reserved word. Etc.) +and not exceed a maximum length. The username can't be someone else's existing username, or perhaps even a reserved word. Etc.)
  • Sanitize the data for security.
  • Pre-format the data if needed (Does the data need to be trimmed? HTML encoded? Etc.)
  • Prep the data for insertion in the database.
  • @@ -109,34 +109,35 @@ It also removes all control structures from your form HTML, permitting it to be folder:

    - +</body> +</html> +

    The Success Page

    @@ -146,18 +147,20 @@ folder:

    folder:

    - +</body> +</html> +

    The Controller

    @@ -166,7 +169,7 @@ folder:

    folder:

    - +</body> +</html> +

    Now reload your page and submit the form so that it triggers an error. Your form fields should be populated @@ -491,22 +496,22 @@ and the error messages will contain a more relevant field name.

    If you prefer to show an error message next to each form field, rather than as a list, you can change your form so that it looks like this:

    - +<h5>Email Address</h5> +<?=$this->validation->email_error; ?> +<input type="text" name="email" value="<?=$this->validation->email;?>" size="50" /></textarea>

    If there are no errors, nothing will be shown. If there is an error, the message will appear, wrapped in the delimiters you have set (<p> tags by default).

    @@ -589,16 +594,13 @@ For example, your "username" error will be available at:
    $this->valida Returns FALSE if the form element does not contain a valid email address.   - + valid_ip No Returns FALSE if the supplied IP is not valid.   - - -

    Note: These rules can also be called as discreet functions. For example:

    @@ -714,7 +716,7 @@ Previous Topic:  User Agent Class Top of Page   ·   User Guide Home   ·   Next Topic:  XML-RPC Class -

    +

    CodeIgniter  ·  Copyright © 2007  ·  Ellislab, Inc.

    -- cgit v1.2.3-24-g4f1b