Skip to content

Commit e1bc939

Browse files
authored
Merge pull request #525 from ExpressionEngine/feature/inline-member-registration-errors
Feature/inline member registration errors
2 parents 8d7e23a + 7558c12 commit e1bc939

File tree

1 file changed

+78
-55
lines changed

1 file changed

+78
-55
lines changed

docs/member/registration.md

Lines changed: 78 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ This parameter allows you to specify the primary role to assign the new member,
3939

4040
The primary role that will be assigned to registered member. If omited, the default role will be assigned.
4141

42+
### `error_handling="inline"`
43+
error_handling="inline"
44+
45+
This parameter allows you to use inline errors in your registration form. The errors can be displayed using `{error:field_name}` name where `field_name` would need to be replaced with the name of the field that has error, as used to compose the form.
46+
4247
## Form Inputs
4348
NOTE: Be sure to include the required Javascript and CSS to use the native [Password Validation](member/password-validation.md).
4449

@@ -60,8 +65,8 @@ Terms of Service acceptance. This is a **required** field:
6065

6166
Member password. This is a **required** field.
6267

63-
<label>Your New Password</label><br />
64-
<input type="password" name="password" value="" maxlength="50" size="40" />
68+
<label>Your New Password</label><br />
69+
<input type="password" name="password" value="" maxlength="50" size="40" />
6570

6671

6772
### Password Confirmation
@@ -91,22 +96,35 @@ Custom member fields that have "Show in registration?" setting turned on can be
9196
Please note you need to address those by ID and not name, e.g. `m_field_id_8`
9297

9398
<label for="work_title">Work title</label>
94-
<input type="text" id="work_title" name="m_field_id_1" size="40" />
99+
<input type="text" id="work_title" name="m_field_id_1" size="40" value="{if m_field_id_1}{m_field_id_1}{/if}" />
95100

96101
## Variables
97102

98103
### `{accept_terms}`
99104

100105
{if accept_terms == 'y'}checked="checked"{/if}
101106

107+
### `{error:accept_terms}`
108+
109+
{if error:accept_terms}{error:accept_terms}{/if}
110+
102111
### `{email}`
103112

104113
{if email}{email}{/if}
105114

115+
### `{error:email}`
116+
117+
{if error:email}{error:email}{/if}
118+
106119
### `{password}`
107120

108121
{if password}{password}{/if}
109122

123+
### `{error:password}`
124+
125+
{if error:password}{error:password}{/if}
126+
This will show errors with the submitted password as well as password confirm.
127+
110128
### `{password_confirm}`
111129

112130
{if password_confirm}{password_confirm}{/if}
@@ -119,61 +137,66 @@ Please note you need to address those by ID and not name, e.g. `m_field_id_8`
119137

120138
{if username}{username}{/if}
121139

140+
### `{error:username}`
141+
142+
{if error:username}{error:username}{/if}
143+
122144

123145
## Example
124146

125147
{exp:member:registration_form
126148
return="member/registration/success"
127-
}
128-
129-
<p>* Required fields</p>
130-
<fieldset>
131-
<h4>Login details</h4>
132-
133-
<p>
134-
<label for="username">Username*:</label><br />
135-
<input type="text" name="username" id="username" value="{if username}{username}{/if}"/><br />
136-
</p>
137-
138-
<p>
139-
<label for="email">Email*:</label><br />
140-
<input type="text" name="email" id="email" value="{if email}{email}{/if}"/><br />
141-
</p>
142-
143-
<p>
144-
<label for="something">Something*:</label><br />
145-
<input type="text" name="something" id="something" value="{if something}{something}{/if}"/><br />
146-
</p>
147-
148-
<p>
149-
<label for="password">Password*:</label><br />
150-
<input type="password" name="password" id="password" value="{if password}{password}{/if}"/>
151-
</p>
152-
153-
<p>
154-
<label for="password_confirm">Confirm password*:</label><br />
155-
<input type="password" name="password_confirm" id="password_confirm" value="{if password_confirm}{password_confirm}{/if}"/>
156-
</p>
157-
158-
<p>
159-
<label for="terms_of_service">Terms of service:</label><br />
160-
<div>All messages posted at this site express the views of the author, and do not necessarily reflect the views of the owners and administrators
161-
of this site.By registering at this site you agree not to post any messages that are obscene, vulgar, slanderous, hateful, threatening, or that violate any laws. We will
162-
permanently ban all users who do so.We reserve the right to remove, edit, or move any messages for any reason.</div>
163-
</p>
164-
165-
<p>
166-
<label><input type="checkbox" name="accept_terms" value="y" {if accept_terms == 'y'}checked="checked"{/if} /> I accept these terms</label>
167-
</p>
168-
169-
{if captcha}
170-
<p>
171-
<label for="captcha">{lang:captcha}*</label>
172-
{captcha}<br/>
173-
<input type="text" id="captcha" name="captcha" value="" size="20" maxlength="20" style="width:140px;"/>
174-
</p>
175-
{/if}
176-
</fieldset>
177-
178-
<input type="submit" value="Register" class="btn btn-primary" />
149+
error_handling="inline"
150+
}
151+
152+
<p>* Required fields</p>
153+
<fieldset>
154+
<h4>Login details</h4>
155+
156+
<p>
157+
<label for="username">Username*: {if error:username}{error:username}{/if}</label><br />
158+
<input type="text" name="username" id="username" value="{if username}{username}{/if}"/><br />
159+
</p>
160+
161+
<p>
162+
<label for="email">Email*: {if error:email}{error:email}{/if}</label><br />
163+
<input type="text" name="email" id="email" value="{if email}{email}{/if}"/><br />
164+
</p>
165+
166+
<p>
167+
<label for="something">Something*: {if error:m_field_id_1}{error:m_field_id_1}{/if}</label><br />
168+
<input type="text" name="m_field_id_1" id="something" value="{if m_field_id_1}{m_field_id_1}{/if}"/><br />
169+
</p>
170+
171+
<p>
172+
<label for="password">Password*: {if error:password}{error:password}{/if}</label><br />
173+
<input type="password" name="password" id="password" value="{if password}{password}{/if}"/>
174+
</p>
175+
176+
<p>
177+
<label for="password_confirm">Confirm password*: </label><br />
178+
<input type="password" name="password_confirm" id="password_confirm" value="{if password_confirm}{password_confirm}{/if}"/>
179+
</p>
180+
181+
<p>
182+
<label for="terms_of_service">Terms of service:</label><br />
183+
<div>All messages posted at this site express the views of the author, and do not necessarily reflect the views of the owners and administrators
184+
of this site.By registering at this site you agree not to post any messages that are obscene, vulgar, slanderous, hateful, threatening, or that violate any laws. We will
185+
permanently ban all users who do so.We reserve the right to remove, edit, or move any messages for any reason.</div>
186+
</p>
187+
188+
<p>
189+
<label><input type="checkbox" name="accept_terms" value="y" {if accept_terms == 'y'}checked="checked"{/if} /> I accept these terms {if error:accept_terms}{error:accept_terms}{/if}</label>
190+
</p>
191+
192+
{if captcha}
193+
<p>
194+
<label for="captcha">{lang:captcha}*</label>
195+
{captcha}<br/>
196+
<input type="text" id="captcha" name="captcha" value="" size="20" maxlength="20" style="width:140px;"/>
197+
</p>
198+
{/if}
199+
</fieldset>
200+
201+
<input type="submit" value="Register" class="btn btn-primary" />
179202
{/exp:member:registration_form}

0 commit comments

Comments
 (0)