我正在使用Reactstrap v8.0.1,并尝试显示错误消息并使用红色边框呈现字段,但它似乎根本不起作用
下面是我用来呈现窗体的代码...但是什么都没有。
<Col lg="5">
<Card className="bg-secondary shadow border-0">
<CardBody className="px-lg-5 py-lg-5">
<Form role="form">
<FormGroup className="mb-3">
<InputGroup className="input-group-alternative">
<InputGroupAddon addonType="prepend">
<InputGroupText>
<i className="ni ni-email-83" />
</InputGroupText>
</InputGroupAddon>
<Input placeholder="Email" type="email" name="emailAddress" invalid />
</InputGroup>
<FormFeedback>This bollocks is not showing!!!!</FormFeedback>
</FormGroup>
<div className="text-center">
<Button className="my-4" color="primary" type="button">Submit</Button>
</div>
</Form>
</CardBody>
</Card>
</Col>有没有人在显示表单反馈时遇到了问题?
发布于 2020-01-26 23:34:57
为了正常工作,FormFeedback块必须与输入块在同一父块中,而且更好的做法是将其标记为在输入无效时通过向其添加该属性来显示,例如:
<Col lg="5">
<Card className="bg-secondary shadow border-0">
<CardBody className="px-lg-5 py-lg-5">
<Form role="form">
<FormGroup className="mb-3">
<InputGroup className="input-group-alternative">
<InputGroupAddon addonType="prepend">
<InputGroupText>
<i className="ni ni-email-83" />
</InputGroupText>
</InputGroupAddon>
<Input
placeholder="Email"
type="email"
name="emailAddress"
invalid={type invalid condition here!} />
<FormFeedback invalid>This bollocks is not showing!!!!</FormFeedback>
</InputGroup>
</FormGroup>
<div className="text-center">
<Button className="my-4" color="primary" type="button">Submit</Button>
</div>
</Form>
</CardBody>
</Card>
</Col>发布于 2020-09-29 19:45:17
你需要在"InputGroup“中移动"FormFeedback”,然后它就会起作用。
https://stackoverflow.com/questions/57815720
复制相似问题