Skip to content

Commit 69b2f46

Browse files
authored
Merge pull request #6661 from kenjis/fix-docs-form_helper.rst
docs: improve form_helper.rst
2 parents 583c8cf + b9bea2d commit 69b2f46

File tree

6 files changed

+34
-6
lines changed

6 files changed

+34
-6
lines changed

user_guide_src/source/helpers/form_helper.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The following functions are available:
5353
:returns: An HTML form opening tag
5454
:rtype: string
5555

56-
Creates an opening form tag with a site URL **built from your config preferences**.
56+
Creates an opening form tag with a site URL **built from your** ``Config\App::$baseURL``.
5757
It will optionally let you add form attributes and hidden input fields, and
5858
will always add the `accept-charset` attribute based on the charset value in your
5959
config file.
@@ -70,7 +70,7 @@ The following functions are available:
7070

7171
<form action="http://example.com/index.php/email/send" method="post" accept-charset="utf-8">
7272

73-
You can also add {locale} like the following:
73+
You can also add ``{locale}`` like the following:
7474

7575
.. literalinclude:: form_helper/004.php
7676

@@ -94,7 +94,7 @@ The following functions are available:
9494

9595
<form action="http://example.com/index.php/email/send" class="email" id="myform" method="post" accept-charset="utf-8">
9696

97-
If CSRF filter is turned on `form_open()` will generate CSRF field at the beginning of the form. You can specify ID of this field by passing csrf_id as one of the ``$attribute`` array:
97+
If CSRF filter is turned on ``form_open()`` will generate CSRF field at the beginning of the form. You can specify ID of this field by passing csrf_id as one of the ``$attribute`` array:
9898

9999
.. literalinclude:: form_helper/007.php
100100

@@ -175,6 +175,10 @@ The following functions are available:
175175

176176
.. literalinclude:: form_helper/014.php
177177

178+
If you want boolean attributes, pass the boolean value (``true``/``false``). In this case the boolean value does not matter:
179+
180+
.. literalinclude:: form_helper/035.php
181+
178182
If you would like your form to contain some additional data, like
179183
JavaScript, you can pass it as a string in the third parameter:
180184

@@ -301,7 +305,7 @@ The following functions are available:
301305
:returns: An HTML fieldset closing tag
302306
:rtype: string
303307

304-
Produces a closing </fieldset> tag. The only advantage to using this
308+
Produces a closing ``</fieldset>`` tag. The only advantage to using this
305309
function is it permits you to pass data to it which will be added below
306310
the tag. For example
307311

@@ -425,7 +429,7 @@ The following functions are available:
425429
:returns: An HTML form closing tag
426430
:rtype: string
427431

428-
Produces a closing </form> tag. The only advantage to using this
432+
Produces a closing ``</form>`` tag. The only advantage to using this
429433
function is it permits you to pass data to it which will be added below
430434
the tag. For example:
431435

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
<?php
22

33
echo form_input('username', 'johndoe');
4+
/*
5+
* Would produce:
6+
* <input type="text" name="username" value="johndoe" />
7+
*/

user_guide_src/source/helpers/form_helper/014.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
'size' => '50',
99
'style' => 'width:50%',
1010
];
11-
1211
echo form_input($data);
1312
/*
1413
* Would produce:

user_guide_src/source/helpers/form_helper/015.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22

33
$js = 'onClick="some_function ()"';
44
echo form_input('username', 'johndoe', $js);
5+
/*
6+
* Would produce:
7+
* <input type="text" name="username" value="johndoe" onClick="some_function ()" />
8+
*/

user_guide_src/source/helpers/form_helper/016.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22

33
$js = ['onClick' => 'some_function ();'];
44
echo form_input('username', 'johndoe', $js);
5+
/*
6+
* Would produce:
7+
* <input type="text" name="username" value="johndoe" onClick="some_function ();" />
8+
*/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
$data = [
4+
'name' => 'username',
5+
'id' => 'username',
6+
'value' => '',
7+
'required' => true,
8+
];
9+
echo form_input($data);
10+
/*
11+
* Would produce:
12+
* <input type="text" name="username" value="" id="username" required />
13+
*/

0 commit comments

Comments
 (0)