summaryrefslogtreecommitdiffstats
path: root/user_guide_src
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-03-04 16:33:16 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-03-04 16:33:16 +0100
commite30e400581a663045486985d0e75bc77631a2ef2 (patch)
tree2dc878458e04877526fb6a3dbe37103dbd0317dc /user_guide_src
parenta2bd3637c0eeb9e0e6be48dd10167febac440774 (diff)
parent67f27bdba328129134a41c06aec47210d9a21713 (diff)
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
Diffstat (limited to 'user_guide_src')
-rw-r--r--user_guide_src/source/changelog.rst1
-rw-r--r--user_guide_src/source/libraries/form_validation.rst35
2 files changed, 33 insertions, 3 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 89a6a9540..e96076164 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -83,6 +83,7 @@ Release Date: Not Released
- Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`.
- Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which makes token regeneration optional.
- Added function error_array() to return all error messages as an array in the Form_validation class.
+ - Added function set_data() to Form_validation library, which can be used in place of the default $_POST array.
- Changed the Session library to select only one row when using database sessions.
- Core
diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst
index 09a192bb0..2fe315dba 100644
--- a/user_guide_src/source/libraries/form_validation.rst
+++ b/user_guide_src/source/libraries/form_validation.rst
@@ -579,7 +579,27 @@ must supply it as an array to the function. Example::
For more info please see the :ref:`using-arrays-as-field-names` section below.
-.. _saving-groups:
+Validating An Array (Other Than The $_POST Array)
+=================================================
+
+Sometimes you may want to validate an array that does not originate from $_POST data.
+
+In this case, you can specify the array to be validated::
+
+ $data = array(
+ 'username' => 'johndoe',
+ 'password' => 'mypassword',
+ 'passconf' => 'mypassword'
+ ));
+
+ $this->form_validation->set_data($data);
+
+Creating validation rules, running the validation and retrieving error messages works the same whether you are
+validating $_POST data or an array.
+
+For more info please see the :ref:`function-reference` section below.
+
+-.. _saving-groups:
************************************************
Saving Sets of Validation Rules to a Config File
@@ -930,6 +950,16 @@ $this->form_validation->set_message();
Permits you to set custom error messages. See :ref:`setting-error-messages`
+$this->form_validation->set_data();
+========================================
+
+ .. php:method:: set_data ($data = '')
+
+ :param array $data: The data to validate
+
+ Permits you to set an array for validation, instead of using the default
+ $_POST array.
+
$this->form_validation->error_array();
========================================
@@ -1019,5 +1049,4 @@ This function is identical to the **set_checkbox()** function above.
::
<input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> />
- <input type="radio" name="myradio" value="2" <?php echo set_radio('myradio', '2'); ?> />
-
+ <input type="radio" name="myradio" value="2" <?php echo set_radio('myradio', '2'); ?> /> \ No newline at end of file