Skip to content

Commit

Permalink
fix: update length requirement and error messaging (#4261)
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinBuyck authored Aug 20, 2024
1 parent a90e4fc commit 2e6ccfe
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 65 deletions.
2 changes: 1 addition & 1 deletion shared-helpers/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
"errors.householdTooBig": "El número de miembros de su hogar es demasiado alto.",
"errors.householdTooSmall": "El número de miembros de su hogar es demasiado bajo.",
"errors.lastNameError": "Por favor ingrese un apellido",
"errors.maxLength": "No debe tener más de 64 caracteres.",
"errors.maxLength": "No debe tener más de %{length} caracteres.",
"errors.notFound.message": "Me temo que no podemos encontrar la página que está buscando. Intente regresar a la página anterior o haga clic abajo para ver listados.",
"errors.notFound.title": "No se encontró la página",
"errors.numberError": "Por favor ingrese un número válido mayor a 0.",
Expand Down
2 changes: 1 addition & 1 deletion shared-helpers/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
"errors.householdTooBig": "Your household size is too big.",
"errors.householdTooSmall": "Your household size is too small.",
"errors.lastNameError": "Please enter a Last Name",
"errors.maxLength": "Must not be more than 64 characters.",
"errors.maxLength": "Must not be more than %{length} characters.",
"errors.notFound.message": "Uh oh, we can’t seem to find the page you’re looking for. Try going back to the previous page or click below to browse listings.",
"errors.notFound.title": "Page Not Found",
"errors.numberError": "Please enter a valid number greater than 0.",
Expand Down
2 changes: 1 addition & 1 deletion shared-helpers/src/locales/tl.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
"errors.householdTooBig": "Napakalaki ng iyong sambahayan.",
"errors.householdTooSmall": "Napakaliit ng iyong sambahayan.",
"errors.lastNameError": "Pakilagay ang Apelyido",
"errors.maxLength": "Hindi dapat higit sa 64 na character.",
"errors.maxLength": "Hindi dapat higit sa %{length} na character.",
"errors.notFound.message": "Sori, mukhang hindi namin makita ang page na hinahanap mo. Pakisubukang bumalik sa dating page o mag-click sa ibaba para mag-browse ng mga listahan.",
"errors.notFound.title": "Hindi Nahanap ang Page",
"errors.numberError": "Pakilagay ang tamang numero na mas malaki sa 0.",
Expand Down
2 changes: 1 addition & 1 deletion shared-helpers/src/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
"errors.householdTooBig": "Quy mô hộ gia đình của quý vị quá lớn.",
"errors.householdTooSmall": "Quy mô hộ gia đình của quý vị quá nhỏ.",
"errors.lastNameError": "Vui lòng nhập Họ",
"errors.maxLength": "Không được nhiều hơn 64 ký tự.",
"errors.maxLength": "Không được nhiều hơn %{length} ký tự.",
"errors.notFound.message": "Rất tiếc, chúng tôi dường như không thể tìm thấy trang quý vị đang tìm kiếm. Hãy thử quay lại trang trước hoặc nhấp vào bên dưới để duyệt các danh sách nhà.",
"errors.notFound.title": "Không Tìm thấy Trang",
"errors.numberError": "Vui lòng nhập một số hợp lệ lớn hơn 0.",
Expand Down
2 changes: 1 addition & 1 deletion shared-helpers/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
"errors.householdTooBig": "您的家庭人數過多。",
"errors.householdTooSmall": "您的家庭人數過少。",
"errors.lastNameError": "請輸入姓氏",
"errors.maxLength": "不得超过 64 个字符",
"errors.maxLength": "不得超过 %{length} 个字符",
"errors.notFound.message": "嗯,我們似乎找不到您要的網頁。請嘗試返回上一頁,或點擊下面以瀏覽上市名單。",
"errors.notFound.title": "找不到網頁",
"errors.numberError": "請輸入一個大於 0 的有效數字。",
Expand Down
12 changes: 6 additions & 6 deletions shared-helpers/src/views/address/FormAddressAlternate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const FormAddressAlternate = ({
validation={{ required: true, maxLength: 64 }}
errorMessage={
resolveObject(`${dataKey}.street`, errors)?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.streetError")
}
error={!!resolveObject(`${dataKey}.street`, errors)}
Expand All @@ -46,7 +46,7 @@ export const FormAddressAlternate = ({
register={register}
error={!!resolveObject(`${dataKey}.street2`, errors)}
validation={{ maxLength: 64 }}
errorMessage={t("errors.maxLength")}
errorMessage={t("errors.maxLength", { length: 64 })}
/>

<div className="flex">
Expand All @@ -59,7 +59,7 @@ export const FormAddressAlternate = ({
error={!!resolveObject(`${dataKey}.city`, errors)}
errorMessage={
resolveObject(`${dataKey}.city`, errors)?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.cityError")
}
dataTestId="address-city"
Expand All @@ -73,7 +73,7 @@ export const FormAddressAlternate = ({
error={!!resolveObject(`${dataKey}.state`, errors)}
errorMessage={
resolveObject(`${dataKey}.state`, errors)?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.stateError")
}
register={register}
Expand All @@ -88,11 +88,11 @@ export const FormAddressAlternate = ({
name={`${dataKey}.zipCode`}
label={t("application.contact.zip")}
register={register}
validation={{ required, maxLength: 64 }}
validation={{ required, maxLength: 10 }}
error={!!resolveObject(`${dataKey}.zipCode`, errors)}
errorMessage={
resolveObject(`${dataKey}.zipCode`, errors)?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 10 })
: t("errors.zipCodeError")
}
dataTestId="address-zipcode"
Expand Down
4 changes: 2 additions & 2 deletions shared-helpers/src/views/multiselectQuestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export const multiselectOptionWrapper = (
error={!!resolveObject(`${optionFieldName}-${AddressHolder.Name}`, errors)}
errorMessage={
resolveObject(`${optionFieldName}-${AddressHolder.Name}`, errors)?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.requiredFieldError")
}
dataTestId="addressHolder-name"
Expand All @@ -275,7 +275,7 @@ export const multiselectOptionWrapper = (
errorMessage={
resolveObject(`${optionFieldName}-${AddressHolder.Relationship}`, errors)?.type ===
"maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.requiredFieldError")
}
dataTestId="addressHolder-relationship"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const FormMultiselectQuestions = ({
errorMessage={
resolveObject(`${optionFieldName}-${AddressHolder.Name}`, errors)?.type ===
"maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.requiredFieldError")
}
/>
Expand All @@ -127,7 +127,7 @@ const FormMultiselectQuestions = ({
errorMessage={
resolveObject(`${optionFieldName}-${AddressHolder.Relationship}`, errors)?.type ===
"maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.requiredFieldError")
}
/>
Expand Down
6 changes: 3 additions & 3 deletions sites/public/src/pages/account/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ const Edit = () => {
validation={{ maxLength: 64 }}
errorMessage={
nameErrors.firstName?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.firstNameError")
}
register={nameRegister}
Expand All @@ -265,7 +265,7 @@ const Edit = () => {
label={t("application.name.middleNameOptional")}
error={nameErrors.middleName}
validation={{ maxLength: 64 }}
errorMessage={t("errors.maxLength")}
errorMessage={t("errors.maxLength", { length: 64 })}
dataTestId={"account-middle-name"}
/>

Expand All @@ -280,7 +280,7 @@ const Edit = () => {
validation={{ maxLength: 64 }}
errorMessage={
nameErrors.lastName?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.lastNameError")
}
dataTestId={"account-last-name"}
Expand Down
34 changes: 17 additions & 17 deletions sites/public/src/pages/applications/contact/address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ const ApplicationAddress = () => {
validation={{ required: true, maxLength: 64 }}
errorMessage={
errors.applicant?.address?.street?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.streetError")
}
error={errors.applicant?.applicantAddress?.street}
Expand All @@ -319,7 +319,7 @@ const ApplicationAddress = () => {
dataTestId={"app-primary-address-street2"}
error={errors.applicant?.applicantAddress?.street2}
validation={{ maxLength: 64 }}
errorMessage={t("errors.maxLength")}
errorMessage={t("errors.maxLength", { length: 64 })}
/>

<div className="flex max-w-2xl">
Expand All @@ -331,7 +331,7 @@ const ApplicationAddress = () => {
validation={{ required: true, maxLength: 64 }}
errorMessage={
errors.applicant?.address?.city?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.cityError")
}
error={errors.applicant?.applicantAddress?.city}
Expand All @@ -347,7 +347,7 @@ const ApplicationAddress = () => {
error={errors.applicant?.applicantAddress?.state}
errorMessage={
errors.applicant?.applicantAddress?.state?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.stateError")
}
register={register}
Expand All @@ -362,10 +362,10 @@ const ApplicationAddress = () => {
name="applicant.applicantAddress.zipCode"
label={t("application.contact.zip")}
defaultValue={application.applicant.applicantAddress.zipCode}
validation={{ required: true, maxLength: 64 }}
validation={{ required: true, maxLength: 10 }}
errorMessage={
errors.applicant?.applicantAddress?.zipCode?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 10 })
: t("errors.zipCodeError")
}
error={errors.applicant?.applicantAddress?.zipCode}
Expand Down Expand Up @@ -407,7 +407,7 @@ const ApplicationAddress = () => {
error={errors.applicationsMailingAddress?.street}
errorMessage={
errors.applicationsMailingAddress?.street?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.streetError")
}
register={register}
Expand All @@ -423,7 +423,7 @@ const ApplicationAddress = () => {
dataTestId={"app-primary-mailing-address-street2"}
validation={{ maxLength: 64 }}
error={errors.applicationsMailingAddress?.street2}
errorMessage={t("errors.maxLength")}
errorMessage={t("errors.maxLength", { length: 64 })}
/>

<div className="flex max-w-2xl">
Expand All @@ -436,7 +436,7 @@ const ApplicationAddress = () => {
error={errors.applicationsMailingAddress?.city}
errorMessage={
errors.applicationsMailingAddress?.city?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.cityError")
}
register={register}
Expand All @@ -451,7 +451,7 @@ const ApplicationAddress = () => {
validation={{ required: true, maxLength: 64 }}
errorMessage={
errors.applicationsMailingAddress?.state?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.stateError")
}
error={errors.applicationsMailingAddress?.state}
Expand All @@ -468,11 +468,11 @@ const ApplicationAddress = () => {
name="applicationsMailingAddress.zipCode"
label={t("application.contact.zip")}
defaultValue={application.applicationsMailingAddress.zipCode}
validation={{ required: true, maxLength: 64 }}
validation={{ required: true, maxLength: 10 }}
error={errors.applicationsMailingAddress?.zipCode}
errorMessage={
errors.applicationsMailingAddress?.zipCode?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 10 })
: t("errors.zipCodeError")
}
register={register}
Expand Down Expand Up @@ -571,7 +571,7 @@ const ApplicationAddress = () => {
error={errors.applicant?.applicantWorkAddress?.street}
errorMessage={
errors.applicant?.applicantWorkAddress?.street?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.streetError")
}
register={register}
Expand Down Expand Up @@ -601,7 +601,7 @@ const ApplicationAddress = () => {
error={errors.applicant?.applicantWorkAddress?.city}
errorMessage={
errors.applicant?.applicantWorkAddress?.city?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.cityError")
}
register={register}
Expand All @@ -617,7 +617,7 @@ const ApplicationAddress = () => {
error={errors.applicant?.applicantWorkAddress?.state}
errorMessage={
errors.applicant?.applicantWorkAddress?.state?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.stateError")
}
register={register}
Expand All @@ -633,11 +633,11 @@ const ApplicationAddress = () => {
name="applicant.applicantWorkAddress.zipCode"
label={t("application.contact.zip")}
defaultValue={application.applicant.applicantWorkAddress.zipCode}
validation={{ required: true, maxLength: 64 }}
validation={{ required: true, maxLength: 10 }}
error={errors.applicant?.applicantWorkAddress?.zipCode}
errorMessage={
errors.applicant?.applicantWorkAddress?.zipCode?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 10 })
: t("errors.zipCodeError")
}
register={register}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const ApplicationAlternateContactContact = () => {
dataTestId={"app-alternate-mailing-address-street"}
error={errors.mailingAddress?.street}
validation={{ maxLength: 64 }}
errorMessage={t("errors.maxLength")}
errorMessage={t("errors.maxLength", { length: 64 })}
/>
<Field
id="mailingAddress.street2"
Expand All @@ -147,7 +147,7 @@ const ApplicationAlternateContactContact = () => {
defaultValue={application.alternateContact.address.street2}
error={errors.mailingAddress?.street2}
validation={{ maxLength: 64 }}
errorMessage={t("errors.maxLength")}
errorMessage={t("errors.maxLength", { length: 64 })}
/>
<div className="flex max-w-2xl">
<Field
Expand All @@ -159,7 +159,7 @@ const ApplicationAlternateContactContact = () => {
dataTestId={"app-alternate-mailing-address-city"}
error={errors.mailingAddress?.city}
validation={{ maxLength: 64 }}
errorMessage={t("errors.maxLength")}
errorMessage={t("errors.maxLength", { length: 64 })}
/>

<Select
Expand All @@ -174,7 +174,7 @@ const ApplicationAlternateContactContact = () => {
dataTestId={"app-alternate-mailing-address-state"}
error={errors.mailingAddress?.state}
validation={{ maxLength: 64 }}
errorMessage={t("errors.maxLength")}
errorMessage={t("errors.maxLength", { length: 64 })}
/>
</div>
<Field
Expand All @@ -185,8 +185,8 @@ const ApplicationAlternateContactContact = () => {
register={register}
dataTestId={"app-alternate-mailing-address-zip"}
error={errors.mailingAddress?.zipCode}
validation={{ maxLength: 64 }}
errorMessage={t("errors.maxLength")}
validation={{ maxLength: 10 }}
errorMessage={t("errors.maxLength", { length: 10 })}
/>
</fieldset>
</CardSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const ApplicationAlternateContactName = () => {
validation={{ required: true, maxLength: 64 }}
errorMessage={
errors.firstName?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.givenNameError")
}
error={errors.firstName}
Expand All @@ -97,7 +97,7 @@ const ApplicationAlternateContactName = () => {
error={errors.lastName}
errorMessage={
errors.lastName?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("errors.familyNameError")
}
register={register}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const ApplicationAlternateContactType = () => {
error={errors.otherType}
errorMessage={
errors.otherType?.type === "maxLength"
? t("errors.maxLength")
? t("errors.maxLength", { length: 64 })
: t("application.alternateContact.type.otherTypeValidationErrorMessage")
}
register={register}
Expand Down
Loading

0 comments on commit 2e6ccfe

Please sign in to comment.