Core: learn it Step 7 of 16 on the Frontend Developer roadmap
Form validation
Use HTML attributes such as required and pattern first, then JavaScript for friendlier messages. The server must still check everything again, because browser checks can be bypassed.