From 2c245616a7bc89e842b4f39693751c3d28c034f2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Jan 2015 15:40:27 +0200 Subject: Revert 7c4d10660a0a47446474bf97e3cb65f80693f1ee Deprecates form_prep() in favor of html_escape() (again). Related: issue #1953, which was the reason for the reverted commit, but was wrongly interpreted and that shouldn't have happened. Close #2477 --- user_guide_src/source/helpers/form_helper.rst | 85 ++++++++++++++++----------- 1 file changed, 52 insertions(+), 33 deletions(-) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index 4fa5f246b..5af0d4014 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -19,6 +19,31 @@ This helper is loaded using the following code:: $this->load->helper('form'); +Escaping field values +===================== + +You may need to use HTML and characters such as quotes within your form +elements. In order to do that safely, you'll need to use +:doc:`common function <../general/common_functions>` +:func:`html_escape()`. + +Consider the following example:: + + $string = 'Here is a string containing "quoted" text.'; + + + +Since the above string contains a set of quotes, it will cause the form +to break. The :func:`html_escape()` function converts HTML special +characters so that it can be used safely:: + + + +.. note:: If you use any of the form helper functions listed on this page, + the form values will be automatically escaped, so there is no need + to call this function. Use it only if you are creating your own + form elements. + Available Functions =================== @@ -546,37 +571,10 @@ The following functions are available: // Would produce: -.. function:: form_prep([$str = ''[, $is_textarea = FALSE]]) - - :param string $str: Value to escape - :param bool $is_textarea: Whether we're preparing for