Create a server-side validation function - address input validation

Hi, first of all, is it possible to validate whether the address field contains numbers and display an info box below prompting the user to add them if necessary?

Would JavaScript be sufficient for this type of form validation? I’m asking because I know Rust is recommended for better performance, but this is pretty simple logic. I’m also wondering if JS support might be discontinued in the near future, as I’d prefer to avoid having to rebuild the application later.

Here’s an example of a validation function in use:

If you need to display feedback, then I think you need to use a Checkout UI Extension to block the customer journey and then display the feedback in the UI.

Here’s the React API you can use to block the customer’s journey, you can use this to display an error message if validation fails:

Thanks, you are right. It will be much simpler to do this client-side if it is just form input. I’ll check if it is possible to display some message info on the input change event without blocking progress. It should be optional, but I want to inform the Customer that they can add a house number if there is one.

EDIT: I did it on my dev store, and it works like a charm! Without blocking form.

Screenshot 2025-04-01 at 17.14.29

1 Like

Awesome, glad to hear that worked for you!

Feedback looks great :+1: nice job

1 Like