-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed #626 [Input Field Validation] #627
base: master
Are you sure you want to change the base?
Conversation
@karthikeya0800 is attempting to deploy a commit to the al1abb-team Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThis pull request enhances the phone input fields in the invoice form by adding numeric input validation in both the BillFrom and BillTo sections. The Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant F as PhoneInput Field
participant V as Validation Handler
U->>F: Enters phone number
F->>V: onInput event triggers
V->>V: Filter out non-digit characters
V->>F: Return sanitized, numeric value
F->>U: Display validated phone input
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/components/invoice/form/sections/BillToSection.tsx (1)
81-86
: Good implementation of numeric validation for phone input.The addition of
type="text"
,inputMode="numeric"
, and theonInput
handler effectively restricts the input to numeric characters only, addressing the validation requirement nicely.However, consider these enhancements:
- This implementation removes all non-digit characters including
+
,-
, parentheses, and spaces, which might be problematic for international phone numbers.- Adding an HTML5
pattern
attribute would provide an additional validation layer and improve accessibility.name="receiver.phone" label={_t("form.steps.fromAndTo.phone")} placeholder="Receiver phone number" type="text" inputMode="numeric" +pattern="[0-9]*" +aria-describedby="phone-format" onInput={(e) => { const target = e.target as HTMLInputElement; target.value = target.value.replace(/\D/g, ""); }}app/components/invoice/form/sections/BillFromSection.tsx (1)
80-86
: Good implementation of numeric validation for phone input.The addition of
type="text"
,inputMode="numeric"
, and theonInput
handler effectively restricts the input to numeric characters only, addressing the validation requirement nicely.However, consider these enhancements:
- This implementation removes all non-digit characters including
+
,-
, parentheses, and spaces, which might be problematic for international phone numbers.- Adding an HTML5
pattern
attribute would provide an additional validation layer and improve accessibility.name="sender.phone" label={_t("form.steps.fromAndTo.phone")} placeholder="Your phone number" type="text" inputMode="numeric" +pattern="[0-9]*" +aria-describedby="phone-format" onInput={(e) => { const target = e.target as HTMLInputElement; target.value = target.value.replace(/\D/g, ""); }}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/components/invoice/form/sections/BillFromSection.tsx
(2 hunks)app/components/invoice/form/sections/BillToSection.tsx
(1 hunks)
🔇 Additional comments (2)
app/components/invoice/form/sections/BillFromSection.tsx (2)
8-12
: Consistent indentation improvement.The code formatting changes in this file improve readability and maintain a consistent style throughout the codebase.
21-108
: Clean code indentation.The indentation adjustments throughout the component improve code readability while maintaining the same functionality.
Added 3 additional props to FormInput.
Summary by CodeRabbit