We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Style Membership Form Errors when set to be inline

Development and Programming

BenCorn's avatar
BenCorn
13 posts
about 2 years ago
BenCorn's avatar BenCorn

How does one style inline form errors for membership registration? In the source code for example, one field looks like this before submitting with an error:

<label for=”username”>Username*: </label> <input type=”text” name=”username” id=”username” value=”“/>

After submitting and an error message, the source looks like this:

<label for=”username”>Username*: This field is required.</label> <input type=”text” name=”username” id=”username” value=”“/>

My question is how do we apply a class or any kind of styling to the error message, so that it can stand out, when it just becomes a part of the label tag? There doesn’t appear to be a way to add a class to error messages, so how can we make them look different and stand out?

       
Rob Allen's avatar
Rob Allen
3,105 posts
about 2 years ago
Rob Allen's avatar Rob Allen

Are you using the old style “Member profile” templates or the later registration form tags? https://docs.expressionengine.com/latest/member/registration.html

If you’re using the newer registration form the example gives you for instance:

<label for="username">Username*: {if error:username}{error:username}{/if}</label>
        <input type="text" name="username" id="username" value="{if username}{username}{/if}"/>

You can add a span tag to the error tag to give you a styling hook:

{if error:username}<span class="your_class">{error:username}</span>{/if}
? 1
       
BenCorn's avatar
BenCorn
13 posts
about 2 years ago
BenCorn's avatar BenCorn

Yes I am using the new registration form tags - Thanks so much for your reply - that’s really helpful - and of course, now it makes complete sense to me! Thanks again!

       
bubblyeducate's avatar
bubblyeducate
1 posts
one year ago
bubblyeducate's avatar bubblyeducate

I appreciate your response very much; it’s been quite useful. Of course, now it all makes sense to me! Once again, thank you!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.