Add validation feedback helper
This adds a general validation feedback mechanism for checking input values. An initial example is wired up for the username input on registration.
This commit is contained in:
parent
37ecf2a623
commit
338d83ab55
6 changed files with 176 additions and 25 deletions
|
@ -94,11 +94,11 @@ export default class Field extends React.PureComponent {
|
|||
mx_Field_invalid: onValidate && this.state.valid === false,
|
||||
});
|
||||
|
||||
// handle displaying feedback on validity
|
||||
// Handle displaying feedback on validity
|
||||
const Tooltip = sdk.getComponent("elements.Tooltip");
|
||||
let feedback;
|
||||
let tooltip;
|
||||
if (this.state.feedback) {
|
||||
feedback = <Tooltip
|
||||
tooltip = <Tooltip
|
||||
tooltipClassName="mx_Field_tooltip"
|
||||
label={this.state.feedback}
|
||||
/>;
|
||||
|
@ -108,7 +108,7 @@ export default class Field extends React.PureComponent {
|
|||
{prefixContainer}
|
||||
{fieldInput}
|
||||
<label htmlFor={this.props.id}>{this.props.label}</label>
|
||||
{feedback}
|
||||
{tooltip}
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue