add basic validation
This commit is contained in:
parent
4bf8930cd4
commit
7ba357c223
2 changed files with 10 additions and 3 deletions
|
@ -10,6 +10,7 @@ import {
|
|||
SelectOption,
|
||||
SelectVariant,
|
||||
TextInput,
|
||||
ValidatedOptions
|
||||
} from "@patternfly/react-core";
|
||||
import { convertFormValuesToObject, convertToFormValues } from "../../../util";
|
||||
import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
||||
|
@ -158,7 +159,10 @@ export const LdapMapperDetails = () => {
|
|||
id="kc-ldap-mapper-name"
|
||||
data-testid="ldap-mapper-name"
|
||||
name="name"
|
||||
ref={form.register}
|
||||
ref={form.register({ required: true})}
|
||||
validated={
|
||||
form.errors.name ? ValidatedOptions.error : ValidatedOptions.default
|
||||
}
|
||||
/>
|
||||
<TextInput
|
||||
hidden
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { FormGroup, TextInput } from "@patternfly/react-core";
|
||||
import { FormGroup, TextInput, ValidatedOptions } from "@patternfly/react-core";
|
||||
import React from "react";
|
||||
import { HelpItem } from "../../../components/help-enabler/HelpItem";
|
||||
import type { UseFormMethods } from "react-hook-form";
|
||||
|
@ -34,7 +34,10 @@ export const LdapMapperHardcodedLdapGroup = ({
|
|||
id="kc-group"
|
||||
data-testid="mapper-group-fld"
|
||||
name="config.group[0]"
|
||||
ref={form.register}
|
||||
ref={form.register({ required: true })}
|
||||
validated={
|
||||
form.errors.config && form.errors.config.group ? ValidatedOptions.error : ValidatedOptions.default
|
||||
}
|
||||
/>
|
||||
</FormGroup>
|
||||
</>
|
||||
|
|
Loading…
Reference in a new issue