Translate error messages from Shadcn forms using next-intl. Latest version: 0.0.4, last published: 6 months ago. Start using next-intl-shadcn-form in your project by running `npm i next-intl-shadcn-form`. There are no other projects in the npm registry u
然后是表单组件,这是最具挑战性的部分: // 迁移前的 Ant Design 表单import{Form,Input,Select}from'antd'functionUserForm({initialValues,onSubmit}){const[form]=Form.useForm()return(<Form form={form}initialValues={initialValues}onFinish={onSubmit}labelCol={{span:6}}wrapperCol={{span:18}}><Form....
// 迁移前的 Ant Design 表单 import { Form, Input, Select } from 'antd' function UserForm({ initialValues, onSubmit }) { const [form] = Form.useForm() return ( <Form form={form} initialValues={initialValues} onFinish={onSubmit} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}...
parse.error.flatten().fieldErrors 然后在组件中使用 export default function Page() { const { pending } = useFormStatus(); const initialState = { errors: { firstName: undefined, lastName: undefined }, message: undefined }; const initialValues: StudentFormValues = { firstName: "", lastName...
Add validation to prevent converting undefined error messages to string in the FormMessage component. This fix addresses issues that occur in complex validation structures, such as validating entire objects. const formSchema = z.object({ location: z.object({ city: z.string().nonempty(), state:...
@on-error="onError"> <ShadcnFormItem name="username" label="Username" :rules="[ { required: true, message: 'Please input username!' }, { min: 3, message: 'Username must be at least 3 characters' }, { max: 20, message: 'Username cannot exceed 20 characters' } ]"> <ShadcnI...
[] } const initialFormState: ActionResult = { errorTitle: null, errorDesc: [] } export default function FormFlight({ airplanes }: FormFlightProps) { const [state, formAction] = useFormState(saveFlight, initialFormState) function ComboboxDemo() { const [open, setOpen] = React.useState(...
</Form> </SheetContent> </> ) } typescript next.js react-hook-form zod shadcnui 1个回答 0投票 不熟悉 Shadcdn,但我相信您无法关闭工作表,因为您没有更改控制工作表的布尔状态变量。 <Sheet open={isOpen} onOpenChange={() => setIsOpen(true)}> setIsOpen永远不会得到错误值。我认为,当...
<SheetFooter> <SheetClose asChild> <Button type="submit">Save changes</Button> </SheetClose> </SheetFooter> </form> </Form> </div> </SheetContent> </Sheet > 我尝试向 aria-errormessage 元素添加 onError、 onErrorCapture 和 SheetClose 等属性,但这并不能阻止关闭工作表。 aria-error...
<ShadcnForm ref="formRef" v-model="formData" @on-submit="onSubmit" @on-error="onError"> <ShadcnFormItem name="username" label="Username" :rules="[ { required: true, message: 'Please input username!' }, { min: 3, message: 'Username must be at least 3 characters' }, { max: ...