Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
46 views

Using zod form validation with radio button group that has no default checked value on first render

I have a simple form that I am using zod to validate. For simplicity let's say the form has exactly one user field for specifying a selection: const FormSchema = z.object({ options: z.enum(["...
sherrellbc's user avatar
  • 4,775
0 votes
0 answers
33 views

How to test a custom decorator with a validation pipe in Nest.js?

I've found this GitHub issue comment that has an interesting workaround for accessing a custom decorator through reflection, but the problem is that I'm trying to use it to test my use case which ...
sebasaenz's user avatar
  • 1,937
0 votes
0 answers
16 views

Generate csv template with dropdown list in react

I want my users to be able to download a default spreadsheet file with some fields having drop-down values. I know how to do this with Excel/Google Sheets but I'm unable to do this programmatically ...
Codewith_Edison's user avatar
0 votes
0 answers
66 views

How to map validation errors to use exposed property names in NestJS DTOs?

I'm working on a NestJS project where I need to map validation errors to use the exposed property names defined in my DTOs. Below is my current setup: DTO: import { Expose } from 'class-transformer'; ...
VQH DEV's user avatar
  • 63
0 votes
1 answer
62 views

Binding number to input in Svelte and TypeScript

I have a form in svelte, using shadcn-svelte, and zod. Relevant code snippets: // schema.ts const formSchema = z.object({ /* ... */ maxParticipants: z.number() }); <!-- form.svelte --> &...
imstuck's user avatar
  • 41
1 vote
1 answer
40 views

Client-side validation error animation not resetting properly

I have implemented a form validation and error display system using TransitionGroup for animations. The issueVisible flag controls the visibility of the error message, and determineField() helps ...
Michael's user avatar
  • 319
0 votes
2 answers
64 views

Joi validation not working correctly Nodejs

I am trying to validate a schema. its not very complex. below is my code Joi.object({ mobile: Joi.string() .label('mobile') .pattern(/^(\+)[1-9]\d{7,14}$/) .messages({ 'string....
IronHide's user avatar
-1 votes
0 answers
26 views

How to validate a field that depends on another field of the same schema in Zod

I have a situation where I need to validate a field based on a value of the same schema. Here is a code snippet what should make my intention clear: import { z } from "zod"; const ...
slinden's user avatar
  • 973
0 votes
1 answer
69 views

Is it possible to preprocess discriminator in zod discriminated union?

I need to coerce string formatted numbers to number before using a value in z.discriminatedUnion. Is this possible? Here is a simplified code snippet: import { z } from "zod"; const ...
slinden's user avatar
  • 973
1 vote
1 answer
54 views

Angular Material UI - How to add onBlur validation for checkboxes/radio buttons?

I'm trying to create some simple checkboxes and radio buttons with Angular Material UI. The problem I'm having is getting the red outline onBlur effect when the field is required and the user doesn't ...
bestfirstsearch's user avatar
0 votes
1 answer
55 views

Is there a way in Python to validate return objects like in Typescript?

I am creating objects with complex structure with Python and I would like to have ability to validate them like in Typescript somehow before they are returned from function. Perfect option would be ...
serjou's user avatar
  • 25
0 votes
2 answers
69 views

TypeScript: How to validate input fields with form checkboxes

I have a form with several checkboxes and corresponding input fields. <div class="group-wrap input-element" id="gr_"> <div class="label-bar"> <label&...
mlodhi's user avatar
  • 726
1 vote
1 answer
304 views

How to handle errors in Hono middleware when ID doesn't match regex pattern?

I'm currently working on a bun application using Hono. In one of my routes, I have a URL pattern defined using regex to match the date and title parameters. Here's an example of how it looks: app.get('...
hantoren's user avatar
  • 1,003
2 votes
1 answer
1k views

How to Extend a Zod Object with Another Object and Pick Certain Entries?

I'm using Zod, a TypeScript schema validation library, to validate objects in my application. I have a scenario where I need to validate an object with nested properties and extend it with another ...
hantoren's user avatar
  • 1,003
0 votes
1 answer
85 views

Email validation with angular material chips

I'm trying to create a form with an input using chips to send a message to various emails. I have it almost functional but I don't know how to properly show the message error when you write a invalid ...
Jorge Castillo's user avatar

15 30 50 per page
1
2 3 4 5
45