Marking Symfony forms required fields with an asterisk
Published on 2020-08-25 • Modified on 2020-08-25
In this snippet, we will see how to mark with an asterisk all the required fields of a Symfony form. We will do it with CSS. Inspect the login and password label elements; you will see that the "*" is not hardcoded but comes from the CSS rule we added. Check out the links below to view different approaches to achieve the same goal.
label.required:before {
content: "*";
color: red;
}
Form
More on Stackoverflow Read the doc More on the web Random snippet
Call to action
Did you like this post? You can help me back in several ways: (use the "reply" link on the right to comment or to contact me )
- Report any error/typo.
- Report something that could be improved.
- Like and repost!
- Follow me on Bluesky 🦋
- Subscribe to the RSS feed.
- Click on the More on Stackoverflow buttons to make me win "Announcer" badges 🏅.
Thank you for reading! And see you soon on Strangebuzz! 😉