Using controller with headless UI combo-box

74 Views Asked by At

I'm trying to use react-hook-form with zod to validate whether the coordinates of a location falls within a polygon of coordinates. I'm using the react-hook-form controller component to try and register my combo-box, but I notice that react-hook-forms is not collecting any value from the combo-box. I'm not sure how to properly assign the onChange handler to my combo-box. I took a look at the docs and noticed that the argument of onChange() for the controller component didn't necessarily have to be an event, but when I look at the source code, onChange() takes an event. I suspect that my error is originating from that.

What I want to happen is react-hook-form to verify that the entered address lies within my defined polygon of coordinates. Here is a reproduction

For testing purposes, an address that lies within the polygon is 1701 N Copia St, El Paso, TX 79930, and an address that lies outside the polygon is 1600 Pennsylvania Avenue NW, Washington, DC 20500.

0

There are 0 best solutions below