Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

yup js at least one field required

var schema = yup.object().shape({
  a: yup.string().when(['b', 'c'], {
    is: (b, c) => !b && !c,
    then: yup.string().required()
  }),
  b: yup.string().when(['a', 'c'], {
    is: (a, c) => !a && !c,
    then: yup.string().required()
  }),
  c: yup.string().when(['a', 'b'], {
    is: (a, b) => !a && !b,
    then: yup.string().required()
  })
}, [['a', 'b'], ['a', 'c'], ['b','c']]) // <-- HERE!!!!!!!!
Comment

PREVIOUS NEXT
Code Example
Javascript :: How to Subtract the numbers in the array, starting from the right in javascript 
Javascript :: remove text in div jquery 
Javascript :: how to delete current clicked item in array react 
Javascript :: react linking to documents 
Javascript :: javascript read file 
Javascript :: index of javascript 
Javascript :: edit json text react 
Javascript :: formdata is empty after append in angular 
Javascript :: how to change currency in react-paypal-button-v2 
Javascript :: js remove trailling lines 
Javascript :: javascript table show only first n rows 
Javascript :: adding hbs partials in express.js 
Javascript :: generator function 
Javascript :: javascript reload section 
Javascript :: Hide ReactTooltip after hover off 
Javascript :: Fetch Data Using Getx 
Javascript :: p5.js radians 
Javascript :: lodash omitby 
Javascript :: how to assign empty function in react component props 
Javascript :: node js create pdf from html 
Javascript :: converting circular structure to json 
Javascript :: last index of string in javascript 
Javascript :: constructor function javascript 
Javascript :: area selection on image using javascript 
Javascript :: if javascript 
Javascript :: change bg-color all class 
Javascript :: react-native-image-picker npm 
Javascript :: audio customization 
Javascript :: react native image zoom viewer 
Javascript :: javascript img visible 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =