I need help with basic Liquid form validation

Topic summary

A Shopify theme developer needed to add validation to the Dawn theme’s customer registration form to prevent users from entering special characters or numbers in first and last name fields. Currently, the form accepts any characters (e.g., [email removed] as valid names.

Solution Provided:

  • Add JavaScript validation code to the end of templates/customers/register.liquid
  • The code checks if name fields contain only letters before form submission
  • A screen recording was shared demonstrating the implementation

Outcome:

  • The original poster confirmed the solution works and the issue is resolved
Summarized with AI on November 25. AI used: claude-sonnet-4-5-20250929.

I need to add some form validation to the register.liquid file in the Dawn theme. As of now a new user can be created using any character. I can have my first name be [email removed] and it will accept it as a new user. I simply want a condition that checks to make sure the first and last names only include letters and not numbers or symbols.

For reference here is a piece of the Dawn theme Liquid code from templates/customers/register.liquid

{%- form ‘create_customer’, novalidate: ‘novalidate’ -%}
{%- if form.errors -%}

{{ 'templates.contact.form.error_heading' | t }}

{%- endif -%}
{{ 'customer.register.first_name' | t }}

Hi @BeWater

I would like to give you the suggestion below:

You can try to add the following code at the end of the liquid file: templates/customers/register.liquid


The result will look like my screen recording: https://www.loom.com/share/ed1349e48ed04cd1b00fc568710528e4

I hope that it works for you.

2 Likes

Thank you. I got it working now.