Skip to content

fix(web): add validation for website link fields#55

Open
guangshinhaha wants to merge 1 commit into
feat/posts-frontendfrom
fix/pgtw-37-website-link-validation
Open

fix(web): add validation for website link fields#55
guangshinhaha wants to merge 1 commit into
feat/posts-frontendfrom
fix/pgtw-37-website-link-validation

Conversation

@guangshinhaha
Copy link
Copy Markdown
Collaborator

Summary

  • If either URL or description is filled in a website link row, the other field becomes required — matching PG's cross-field validation behavior (closes [FE] Create 'View only' post - No validation check for website links #37)
  • URL format validation triggers immediately on input — only http:// and https:// URLs are accepted
  • Invalid fields show inline error messages with aria-invalid destructive styling
  • Submit button is disabled when any link row has validation errors

⚠️ PGW cross-check needed

These validation rules were inferred from the PG screenshots in #37 — we're running in mock mode (TW_PG_MOCK=true) and haven't verified against PGW's actual FE/BE. Before merging, need to confirm:

  1. Whether PGW requires both fields when either is filled (vs. allowing URL-only)
  2. Whether PGW validates URL format client-side or only server-side
  3. Whether PGW restricts to http(s):// or allows other protocols (e.g. tel:, mailto:)

Test plan

  • Add a website link row → fill only URL → verify description shows "Description is required." error, submit disabled
  • Add a website link row → fill only description → verify URL shows "URL is required." error, submit disabled
  • Type an invalid URL (e.g. not-a-url) with a description → verify "Please enter a valid URL." error
  • Fill both fields with valid https:// URL → verify no errors, submit enabled
  • Leave a link row completely empty → verify no errors (empty rows are pruned)
  • Cross-check rules against PGW's actual FE/BE codebase

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FE] Create 'View only' post - No validation check for website links

1 participant