prevent writing of remote

This commit is contained in:
keyan 2022-06-02 21:09:27 -05:00
parent 8713bf178a
commit 154e869b8c
1 changed files with 8 additions and 4 deletions

View File

@ -73,10 +73,14 @@ export default function JobForm ({ item, sub }) {
maxBid: Yup.number('must be number')
.integer('must be whole').min(sub.baseCost, `must be at least ${sub.baseCost}`)
.required('required'),
location: Yup.string().when('remote', {
is: (value) => !value,
then: Yup.string().required('required').trim()
})
location: Yup.string().test(
'no-remote',
"don't write remote, just check the box",
v => !v?.match(/\bremote\b/gi))
.when('remote', {
is: (value) => !value,
then: Yup.string().required('required').trim()
})
})
const position = data?.auctionPosition