admin管理员组文章数量:1425895
I have array iterating options of redux form option... How I will give dafault value and place holder because it shows the first value of array which don't want... I want to show the placeholder instead
<Field
name="facilityId"
ponent="select"
className="form-control"
placeholder="sdsfdsafjdsafijdsaoi"
>
{owners.map((data, i) => {
return (
<option value={data._id} key={i}>{data.profile.name}</option>
)
})}
</Field>
I have array iterating options of redux form option... How I will give dafault value and place holder because it shows the first value of array which don't want... I want to show the placeholder instead
<Field
name="facilityId"
ponent="select"
className="form-control"
placeholder="sdsfdsafjdsafijdsaoi"
>
{owners.map((data, i) => {
return (
<option value={data._id} key={i}>{data.profile.name}</option>
)
})}
</Field>
Share
Improve this question
edited Jun 4, 2018 at 18:08
Ashh
asked Sep 18, 2017 at 11:09
AshhAshh
46.6k16 gold badges111 silver badges137 bronze badges
2 Answers
Reset to default 4You can do the following
<ControlLabel>Patients</ControlLabel>
<Field
name="facilityId"
ponent="select"
className="form-control"
placeholder="sdsfdsafjdsafijdsaoi"
>
<option value="-1" disabled>Choose patient</option>
{owners.map((data, i) => {
return (
<option value={data._id} key={i}>{data.profile.name}</option>
);
})}
</Field>
<FormControl.Feedback />
PS: Sorry if the formatting is off. I'm typing with my phone.
Using Redux-form, multiple select fields, and loading the options asynchronously - I had issues w/ the chosen answer not working 100% of the time. This works in my case. Notice the value
is ""
.
<ControlLabel>Patients</ControlLabel>
<Field
name="facilityId"
ponent="select"
className="form-control"
placeholder="sdsfdsafjdsafijdsaoi"
>
<option value="" disabled>Choose patient</option>
{owners.map((data, i) => {
return (
<option value={data._id} key={i}>{data.profile.name}</option>
);
})}
</Field>
本文标签: javascriptHow to give default value and placeholder to redux form select fieldStack Overflow
版权声明:本文标题:javascript - How to give default value and placeholder to redux form select field? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745396655a2656845.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论