Closed sred36 closed 6 years ago
In edit mode you've to set the form values by using one of these functions patchValue
or setValue
.
for input element the value is populating ,the only select box is not populating becauase its options
do we need to add any extra thing for select box ?
<input className={form-control
} {...handler()} /> is happening <!--- this working>
<selectclassName={form-control
} {...handler()} />//is not happening <!--- this is notworking>
Check the below example:
<FieldControl
name="nationality"
render={({ handler }) => (
<div>
<label>Nationality:</label>
<select style={styles.input} {...handler()}>
<option value="" disabled>
Select
</option>
<option value="us">US</option>
<option value="uk">UK</option>
<option value="india">India</option>
<option value="china">China</option>
</select>
</div>
)}
/>
To set select box value to uk
this.myForm.patchValue({
nationality: "uk"
});
Closing this issue because there is no activity since a long time.
hi @bietkul, Small quick help,
i have one form after submitting the form am storing the data,while edit mode in select box, value is not populating when i use input box its populating.please update me what is causing issue please find the below code.
<FieldControl name="dbName" strict={false} render={({ handler, touched, hasError }: AbstractControl) => (