Closed johndjameson closed 7 months ago
Thanks for putting this together! I’ve got my whole team working through the course this week 💪
When taking the course myself, I noticed a small typo in the lesson text of the “Implement Async Server-Side Validation” chapter:
https://www.pronextjs.dev/tutorials/forms-management-with-next-js-app-router/forms/implement-async-server-side-validation#building-a-zip-code-validator
In the following code block,
"use server"; export async function validateZipCode(zipCode: string): Promise<boolean> { console.log("validateZipcode on SERVER", zipCode) return /^/d{5}.test(zipCode) && zipCode.startsWith('9'); }
/^/d{5}.test(zipCode) should be /^\d{5}/.test(zipCode) instead. The original code causes a syntax error crash when used.
/^/d{5}.test(zipCode)
/^\d{5}/.test(zipCode)
Also, validateZipcode.ts is duplicated as validateZipcode.tsx in the repository. There should be only be the .ts one, right?
validateZipcode.ts
validateZipcode.tsx
.ts
Thanks again! We’re excited to put this pattern into development ✨
Awesome! Thank you so much for the bug report.
@johndjameson thanks for catching this-- fixed!
Thanks for putting this together! I’ve got my whole team working through the course this week 💪
When taking the course myself, I noticed a small typo in the lesson text of the “Implement Async Server-Side Validation” chapter:
https://www.pronextjs.dev/tutorials/forms-management-with-next-js-app-router/forms/implement-async-server-side-validation#building-a-zip-code-validator
In the following code block,
/^/d{5}.test(zipCode)
should be/^\d{5}/.test(zipCode)
instead. The original code causes a syntax error crash when used.Also,
validateZipcode.ts
is duplicated asvalidateZipcode.tsx
in the repository. There should be only be the.ts
one, right?Thanks again! We’re excited to put this pattern into development ✨