Next.js Discord

Discord Forum

Please could someone help me get Select to work in React Hook Forms..

Unanswered
Black carpenter ant posted this in #help-forum
Open in Discord
Black carpenter antOP
Hi, I've been trying for literal hours to add a select feature using Shadcn but it is NOT working. This is my first solo project and I am at my wits ends. It is so frustrating.

I am using zod for form validation.

Here's my prisma schema:
model Issue {
  id           Int      @id @default(autoincrement())
  title        String   @db.VarChar(255)
  organization String   @default("Google") @db.VarChar(255)
  description  String   @db.Text
  status       Status   @default(NEW)
  severity     Severity @default(LOW)
  createdAt    DateTime @default(now())
  updatedAt    DateTime @updatedAt
}

enum Status {
  NEW
  OPEN
  IN_PROGRESS
  ON_HOLD
  CLOSED
}

enum Severity {
  LOW
  MEDIUM
  HIGH
  CRITICAL
}



my zod validation schema:

export const IssueSchema = z.object({
    title: z.string().min(10, 'A minimum of 10 characters are required.').max(255),
    description: z.string().min(30, 'A minimum of 30 characters are required.'),
    severity: z.enum(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']),
    status: z.enum(['NEW', 'OPEN', 'IN_PROGRESS', 'ON_HOLD', "CLOSED"]),
});


The form is attached;

I would really appreciate some help in getting this resolved. I am almost about to quit web dev entirely. Been stuck on this for days. Thanks!

The form works fine and posts data correctly until I add zod schema modification and then everything breaks!

0 Replies