Skip to content

Commit

Permalink
Fixed [Input Field Validation #626]
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeya0800 committed Feb 26, 2025
1 parent a95f6a1 commit b324ed3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
11 changes: 5 additions & 6 deletions app/components/invoice/form/sections/BillFromSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ const BillFromSection = () => {
name="sender.phone"
label={_t("form.steps.fromAndTo.phone")}
placeholder="Your phone number"
type="tel"
pattern="\d*"
onKeyPress={(e) => {
if (!/[0-9]/.test(e.key)) {
e.preventDefault();
}
type="text"
inputMode="numeric"
onInput={(e) => {
const target = e.target as HTMLInputElement;
target.value = target.value.replace(/\D/g, "");
}}
/>

Expand Down
9 changes: 5 additions & 4 deletions app/components/invoice/form/sections/BillToSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ const BillToSection = () => {
name="receiver.phone"
label={_t("form.steps.fromAndTo.phone")}
placeholder="Receiver phone number"
onKeyPress={(e) => {
if (!/[0-9]/.test(e.key)) {
e.preventDefault();
}
type="text"
inputMode="numeric"
onInput={(e) => {
const target = e.target as HTMLInputElement;
target.value = target.value.replace(/\D/g, "");
}}
/>

Expand Down

0 comments on commit b324ed3

Please sign in to comment.