Form Validation Helper
Design, validate, and test form inputs for Japanese, Vietnamese, and English systems.
Configuration
Select locale and field type, then copy either per-field markdown or full documentation.
Active locale: Japanese (JA)
Structured Markdown Output
Output format stays consistent across field types for easy reuse in docs and QA plans.
Reference View
Practical rules, examples, and code snippets for Full Name.
Common Field Names
name
full_name
user_name
display_name
Localized Labels
| Locale | Label |
|---|---|
| JA | 氏名 |
| VI | Họ và tên |
| EN | Full Name |
Validation Rules
Required / non-blank
Trim whitespace before validation. Reject empty strings and whitespace-only values.
| Invalid Value | Why Invalid |
|---|---|
| (empty) | Empty value is not allowed. |
| Whitespace-only value becomes empty after trimming. | |
| Control whitespace is still blank input. |
Length constraint
Use 2-80 Unicode characters after trimming.
| Invalid Value | Why Invalid |
|---|---|
| A | Too short; minimum length is 2. |
| Alexandria-Catherine-Marguerite-Evangeline-Rosemont-Lorraine-Saint-Pierre | Exceeds max length of 80 characters. |
| 林 | Single-character name does not meet configured minimum. |
Character whitelist
Allow Unicode letters, spaces, apostrophes, and hyphens. Reject digits and symbol-heavy content.
| Invalid Value | Why Invalid |
|---|---|
| John123 | Digits are not valid in personal names. |
| !!! | Punctuation-only input is invalid. |
| <script>alert(1)</script> | Contains HTML/script payload. |
Valid Values (JA)
- 山田 太郎
- 佐藤 花子
- サトウ ユウキ
QA Test Cases
Positive
- Save profile with valid Unicode name and surrounding spaces, then verify trimming.
- Submit name with apostrophe/hyphen and confirm persistence without replacement.
- Update existing account name from ASCII to local-script characters.
Negative
- Attempt submit with empty/blank value and verify required message.
- Input name containing numerals and confirm validation error.
- Inject HTML/script string and confirm rejected payload.
Edge
- Paste mixed full-width and half-width characters in JA locale.
- Enter name with combining marks in VI locale and verify normalization handling.
- Use long but valid multi-part global name near max length.
Boundary
- Validate length = 2 accepted.
- Validate length = 80 accepted.
- Validate length = 81 rejected.
Code Examples
LARAVEL - Laravel FormRequest Rule
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreProfileRequest extends FormRequest
{
public function rules(): array
{
return [
'full_name' => [
'bail',
'required',
'string',
'min:2',
'max:80',
'regex:/^[\p{L}\p{M}\s'\-]+$/u',
],
];
}
}
NESTJS - NestJS DTO with class-validator
import { Transform } from 'class-transformer'
import { IsNotEmpty, Length, Matches } from 'class-validator'
export class ProfileDto {
@Transform(({ value }) => typeof value === 'string' ? value.trim() : value)
@IsNotEmpty()
@Length(2, 80)
@Matches(/^[\p{L}\p{M}\s'\-]+$/u, {
message: 'full_name contains invalid characters',
})
full_name!: string
}
ZOD - Zod Schema
import { z } from 'zod'
export const fullNameSchema = z
.string()
.trim()
.min(2, 'full_name must have at least 2 characters')
.max(80, 'full_name must be at most 80 characters')
.regex(/^[\p{L}\p{M}\s'\-]+$/u, 'full_name has invalid characters')