Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/components/invoice/form/sections/BillFromSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ const BillFromSection = () => {
name="sender.phone"
label={_t("form.steps.fromAndTo.phone")}
placeholder="Your phone number"
type="text"
inputMode="tel"
pattern="[0-9]*"
aria-describedby="phone-format"
onInput={(e) => {
const target = e.target as HTMLInputElement;
target.value = target.value.replace(/[^\d\+\-\(\)\s]/g, "");
}}
/>

{/* //? key = field.id fixes a bug where wrong field gets deleted */}
Expand Down
8 changes: 8 additions & 0 deletions app/components/invoice/form/sections/BillToSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ const BillToSection = () => {
name="receiver.phone"
label={_t("form.steps.fromAndTo.phone")}
placeholder="Receiver phone number"
type="text"
inputMode="tel"
pattern="[0-9]*"
aria-describedby="phone-format"
onInput={(e) => {
const target = e.target as HTMLInputElement;
target.value = target.value.replace(/[^\d\+\-\(\)\s]/g, "");
}}
/>

{/* //? key = field.id fixes a bug where wrong field gets deleted */}
Expand Down