Skip to content

Commit

Permalink
add error messaging to boundary form and update error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Jul 5, 2024
1 parent bbb4efb commit 3b0dfa6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import { FormProps } from ".";
export default function BoundaryForm({ formikConfig, onSuccess }: FormProps) {
const formSchema = Yup.object().shape({
boundaryUrl: Yup.string()
.url("The URL should be in the form shown above")
.url(
"Enter a boundary URL in the correct format, https://www.planning.data.gov.uk/",
)
.required("Enter a boundary URL"),
});

Expand Down Expand Up @@ -57,6 +59,7 @@ export default function BoundaryForm({ formikConfig, onSuccess }: FormProps) {
<Input
name="boundary"
value={formik.values.boundaryUrl}
errorMessage={formik.errors.boundaryUrl}
onChange={(ev: ChangeEvent<HTMLInputElement>) => {
formik.setFieldValue("boundaryUrl", ev.target.value);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ import { FormProps } from ".";
export default function ContactForm({ formikConfig, onSuccess }: FormProps) {
const formSchema = Yup.object().shape({
helpEmail: Yup.string()
.email("Enter a valid email address")
.email(
"Enter an email address in the correct format, like [email protected]",
)
.required("Enter a help email address"),
helpPhone: Yup.string().required("Enter a help phone number"),
helpOpeningHours: Yup.string().required("Enter your opening hours"),
homepage: Yup.string()
.url("Enter a valid URL")
.url(
"Enter a homepage URL in the correct format, like https://www.localauthority.gov.uk/",
)
.required("Enter a homepage"),
});

Expand Down

0 comments on commit 3b0dfa6

Please sign in to comment.