1
1
'use client'
2
2
3
- import { useRef , useState } from 'react'
3
+ import { ChangeEvent , useRef , useState } from 'react'
4
4
5
5
import { FormFieldType } from '@/types'
6
6
import { cn } from '@/lib/utils'
@@ -122,6 +122,7 @@ export const renderFormField = (field: FormFieldType, form: any) => {
122
122
const [ smartDatetime , setSmartDatetime ] = useState < Date | null > ( )
123
123
const [ countryName , setCountryName ] = useState < string > ( '' )
124
124
const [ stateName , setStateName ] = useState < string > ( '' )
125
+ const [ password , setPassword ] = useState < string > ( '' )
125
126
const canvasRef = useRef < HTMLCanvasElement > ( null )
126
127
127
128
const dropZoneConfig = {
@@ -557,7 +558,17 @@ export const renderFormField = (field: FormFieldType, form: any) => {
557
558
< FormItem >
558
559
< FormLabel > { field . label } </ FormLabel >
559
560
< FormControl >
560
- < PasswordInput value = "password" />
561
+ < PasswordInput
562
+ value = { password }
563
+ placeholder = 'password'
564
+ onChange = { ( e :ChangeEvent < HTMLInputElement > ) => {
565
+ setPassword ( e . target . value )
566
+ form . setValue ( field . name , e . target . value , {
567
+ shouldValidate : true ,
568
+ shouldDirty : true ,
569
+ } )
570
+ } }
571
+ />
561
572
</ FormControl >
562
573
< FormDescription > { field . description } </ FormDescription >
563
574
< FormMessage />
@@ -568,7 +579,15 @@ export const renderFormField = (field: FormFieldType, form: any) => {
568
579
< FormItem >
569
580
< FormLabel > { field . label } </ FormLabel >
570
581
< FormControl >
571
- < PhoneInput defaultCountry = "TR" />
582
+
583
+ < PhoneInput
584
+ defaultCountry = "TR"
585
+ onChange = { ( phoneNumber ) => {
586
+ form . setValue ( field . name , phoneNumber , {
587
+ shouldValidate : true ,
588
+ shouldDirty : true ,
589
+ } )
590
+ } } />
572
591
</ FormControl >
573
592
< FormDescription > { field . description } </ FormDescription >
574
593
< FormMessage />
0 commit comments