Skip to content

Commit

Permalink
fix first name validation
Browse files Browse the repository at this point in the history
  • Loading branch information
akash70629 committed Oct 17, 2024
1 parent 22699fa commit 60d49df
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/User/pages/Contacts/Contact.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ function ContactPage() {
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<label htmlFor="fname" className="block mb-2">First Name</label>
<input type="text" id="fname" className="w-full p-2 border rounded" placeholder="Enter your first name" minLength={3} required/>
<input type="text" id="fname" className="w-full p-2 border rounded" placeholder="Enter your first name" minLength={3} required pattern="[a-zA-Z ]+"
onInvalid={(e) => {
e.target.setCustomValidity('Numbers and Symbols are not allowed.');
}}
onInput={(e) => {
e.target.setCustomValidity('');
}}/>
</div>
<div>
<label htmlFor="lname" className="block mb-2">Last Name</label>
Expand Down

0 comments on commit 60d49df

Please sign in to comment.