There is no way for you to magically hijack JS execution from the client and handle it server-side. JS runs client-side and even if you did make the round-trip to the server and back it’d be entirely voluntary and presumably only done via a websocket layer or the like. You wouldn’t be solving any problem you couldn’t more readily solve by doing validation client-side.