I'm using the following modified version of the user registration form for the purpose of a user updating their details.
<form method="post" accept-charset="UTF-8" enctype="multipart/form-data" class="form form--full">
{{ getCsrfInput() }}
<input type="hidden" name="action" value="users/saveUser">
<input type="hidden" name="redirect" value="profile">
<input type="hidden" name="userId" value="{{ currentUser.id }}">
<fieldset>
<legend class="visually-hidden">Personal details</legend>
{{ account is defined ? _self.errorList(account.getAllErrors()) : 'not' }}
<div class="form__group">
<label class="form__pullLabel" for="firstName">First name<span class="required">*</span></label>
<div class="form__input">
<input id="firstName" type="text" name="firstName" value="{{ currentUser.firstName }}" placeholder="First name" required="required" aria-required="true" autofocus="autofocus">
</div>
</div>
<div class="form__group">
<label class="form__pullLabel" for="lastName">Last name<span class="required">*</span></label>
<div class="form__input">
<input id="lastName" type="text" name="lastName" value="{{ currentUser.lastName }}" placeholder="Surname" required="required" aria-required="true">
</div>
</div>
<div class="form__group">
<label class="form__pullLabel" for="email">Email<span class="required">*</span></label>
<div class="form__input">
<input id="email" type="email" name="email" value="{{ currentUser.email }}" placeholder="Email address" required="required" aria-required="true" disabled="disabled">
</div>
</div>
<div class="form__group">
<label class="form__pullLabel" for="mobileNumber">Phone / Mobile number</label>
<div class="form__input">
<input id="mobileNumber" type="tel" name="fields[mobileNumber]" placeholder="Phone number" value="{{ currentUser.mobileNumber }}" aria-required="false">
</div>
</div>
<div class="form__group">
<label class="form__pullLabel" for="company">Company / Organisation<span class="required">*</span></label>
<div class="form__input">
<input id="company" type="text" name="fields[company]" value="{{ currentUser.company }}" limit="150" placeholder="Company" required="required" aria-required="true">
</div>
</div>
<div class="form__group">
<label class="form__pullLabel" for="position">Position</label>
<div class="form__input">
<input id="position" type="text" name="fields[position]" value="{{ currentUser.position }}" placeholder="Position" aria-required="false">
</div>
</div>
<div class="form__group">
<label class="form__pullLabel" for="profilePhoto">Profile photo</label>
<div class="form__input imageSelect">
{% if currentUser.photoUrl %}
<img src="{{ currentUser.photoUrl }}" id="userPhoto" /><input type="hidden" name="deleteUserPhoto" id="deleteUserPhotoInput" value="">{% else %}<img src="{{ url(siteSettings.defaultUserImage.first.getUrl()) }}" width="100" alt="no profile image" />{% endif %}<input id="profilePhoto" type="file" accept="image/*" capture="camera" name="userPhoto" value="{{ (currentUser.photoUrl ? 'Change Photo' : 'Upload') }}">
{% if currentUser.photoUrl %}
<a id="deleteUserPhotoAction" class="button button--reverse ut-marginTop">Delete</a>
{% endif %}
</div>
</div>
<button class="spinnerHolder button button--full" type="submit">Save details</button>
</fieldset>
</form>
This updates, however I can't seem to get any errors for empty fields
Does anything look off? If not, can you perhaps give a push in the right direction as to why it may not be working?
Thanks
_self.errorList(account.getAllErrors())
- have you actually defined a macro callederrorList
? Your example code doesn't show it.