Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react hook form validation controller

              rules={{
                required: {
                  value: required,
                  message: 'This field is required',
                },
                validate: {
                  fileType: (file) =>
                    !required ||
                    validFileTypes.indexOf(file.type) != -1 ||
                    'We only support (pdf, doc, docx, txt, rtf)',
                },
              }}
Source by react-hook-form.com #
 
PREVIOUS NEXT
Tagged: #react #hook #form #validation #controller
ADD COMMENT
Topic
Name
2+5 =