Skip to content

Conversation

@deveasyclick
Copy link
Owner

Fix: Ensure form fields validate and mark as dirty when autofilled via TestCodes

This PR updates the onSelect handlers across multiple BillPay components to correctly trigger validation and dirty-state updates when autofilling form values from TestCodes.

Previously, selecting a test code would populate the form field but would not:

  • run validation
  • mark the field as dirty

This caused issues where the UI didn’t reflect the expected validation state, and forms could fail submission or skip validation steps.

✅ What’s Changed

Across these components:

  • TV
  • Airtime
  • Data
  • Electricity

form.setValue now includes options:

{
  shouldValidate: true,
  shouldDirty: true,
}

🛠 Updated Example

form.setValue("phone", number, {
  shouldValidate: true,
  shouldDirty: true,
});

🎯 Impact

  • Ensures correct real-time validation when autofilling test data
  • Improves UX by reflecting the proper form state
  • Prevents unexpected submission errors due to unvalidated fields

@vercel
Copy link

vercel bot commented Nov 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
billpay Ready Ready Preview Comment Nov 19, 2025 3:08pm

@deveasyclick deveasyclick merged commit 39e27f5 into main Nov 19, 2025
4 checks passed
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.

1 participant