Skip to content

Commit a2f1d82

Browse files
committed
user guide for {locale} usage in form_open()
1 parent b560240 commit a2f1d82

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

user_guide_src/source/helpers/form_helper.rst

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ The following functions are available:
7575

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

78+
You can also add {locale} like the following::
79+
80+
echo form_open('{locale}/email/send');
81+
82+
The above example would create a form that points to your base URL plus the current request locale with
83+
"email/send" URI segments, like this::
84+
85+
<form method="post" accept-charset="utf-8" action="http://example.com/index.php/en/email/send">
86+
7887
**Adding Attributes**
7988

8089
Attributes can be added by passing an associative array to the second
@@ -90,13 +99,13 @@ The following functions are available:
9099
The above examples would create a form similar to this::
91100

92101
<form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send" class="email" id="myform">
93-
102+
94103
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:
95-
104+
96105
form_open('/u/sign-up', ['csrf_id' => 'my-id']);
97-
106+
98107
will return:
99-
108+
100109
<form action="/u/sign-up" method="post" accept-charset="utf-8">
101110
<input type="hidden" id="my-id" name="csrf_field" value="964ede6e0ae8a680f7b8eab69136717d" />
102111

0 commit comments

Comments
 (0)