Form validation tweaks (#20790)

* ensure id field is expanded on form errors

* only validate id field when name field has no errors

* use ref instead

* all numeric is an invalid name
This commit is contained in:
Josh Hawkins
2025-11-04 08:57:47 -06:00
committed by GitHub
parent 2e288109f4
commit e7394d0dc1
2 changed files with 13 additions and 3 deletions

View File

@@ -43,5 +43,5 @@ export function generateFixedHash(name: string, prefix: string = "id"): string {
* @returns True if the name is valid, false otherwise
*/
export function isValidId(name: string): boolean {
return /^[a-zA-Z0-9_-]+$/.test(name);
return /^[a-zA-Z0-9_-]+$/.test(name) && !/^\d+$/.test(name);
}