All Questions
Tagged with validation reactjs
995 questions
0
votes
0
answers
20
views
React - multiple form fields dependent button enabling
My React web app has the below layout in a page:
a. Common “Info” section (form) at the upper half.
b. Say 4 different “Details” tabs in the lower half. (Also forms)
Now I have a button in a. that ...
0
votes
1
answer
42
views
I am getting multiple validation errors in react function
I am fairly new to React (but have coded in JavaScript and C# for 20 plus years). I have a vanilla form using hook-form, react-bootstrap, zod and flowbite-react. There are two nearly identical ...
-5
votes
2
answers
83
views
Why does my password regex fail to validate a specific string only which have paranthesis as special characters? [duplicate]
I'm trying to validate a password using the following regex in JavaScript:
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]+$/
The validation requirements are:
At least one ...
0
votes
1
answer
25
views
Reactjs : I want to have inline validation error using yup when maxlimit is exceeded in text field
I am trying to have a text-field in a formik form with a max-limit(250 characters) property. I want to display an inline validation error when the user tries to enter 251th character. I am using Yup ...
1
vote
0
answers
42
views
How to Implement Step Validation with react-hook-form without Using Zod Resolver?
I'm working on a multi-step form in React using react-hook-form, and I want to validate each step before allowing the user to proceed. I'm currently using the trigger method for validation, but I keep ...
0
votes
1
answer
35
views
React Bootstrap Form Validation - isInvalid Not Setting Form Invalid
I have two textboxes on a form, as follows:
<div className="row">
<div className="col-md-6">
{ /* Password */}
<Form.Group>
<label>Password&...
0
votes
2
answers
76
views
React form validation for Zipcode when input type is number
I am working on a simple customer intake form, and as part of the validation I need to make sure that a proper zipcode has been included. I know regex would be the easiest way to solve this issue, but ...
0
votes
0
answers
22
views
React dynamic form validation minimize rerendering
I have a dynamic form -- as in, a form defined by data like
[{
id: "password",
type: "text",
label: "Password",
validations: [{
type: "required",
...
-1
votes
1
answer
103
views
React hook form trigger not working properly [duplicate]
I'm trying to create a multi step form using react hook form + zod. On the main page I have this
const steps = [
{ name: "Expertise Areas", fields: ["expertise_areas"] },
{ ...
-1
votes
1
answer
69
views
form still submitting even though input is incorrect react
I have a contact form I have created with validation and it mostly works. However it still gets submitted even if the information is wrong. Here is my code:
//ContactForm.jsx:
const ContactForm = () =...
0
votes
0
answers
43
views
Using setCustomValidity stops input from validating
I'm wanting to set a custom validation message when my input does not meet the required regex pattern.
I know that we can use the setCustomValidity() function built into an input to do this, however ...
0
votes
0
answers
32
views
Why are errors missing from my custom validator?
I am using rjsf FormBuilder to make a form in a react application.
I'm trying to track down some strange error behavior, and along the way I tried adding some customValidate to examine errors.
What's ...
0
votes
0
answers
40
views
The dynamic validation I created with Formik and Yup isn't working correctly
I am trying to write a custom yup util for my project. my goal here is to make the form fields specified according to the data coming from the backend service conform to a single type or rule (eg. key-...
-4
votes
1
answer
67
views
Is it possible to validate and allow only https url's using .isUri using this library https://github.com/ogt/valid-url? [closed]
Is there a way to validate "https" url's using .isUri from this library https://github.com/ogt/valid-url in javascript (it should return true only for https url's)? (any other method should ...
0
votes
1
answer
400
views
How to pass a ZOD schema to a client component so i can dynamically set validation for an input field
I have recently created a input field client component for a POC that needed some inbuilt validation. I initially hard coded this as we just wanted to show that the ui does change based on if the ...