Skip to content

Commit

Permalink
Fix bugs with VSR age & num children
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminJohnson2204 committed Feb 24, 2024
1 parent f3c8d35 commit 3c2a5aa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions frontend/src/app/vsr/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ const VeteranServiceRequest: React.FC = () => {
</div>

<div className={styles.numChildren}>
{Array.from({ length: numChildrenThisGender }, (_, index) => (
{/* Cap it at 100 children per gender to avoid freezing web browser */}
{Array.from({ length: Math.min(numChildrenThisGender, 100) }, (_, index) => (
<div key={index} className={styles.childInputWrapper}>
<TextField
label={`Age`}
Expand Down Expand Up @@ -241,13 +242,15 @@ const VeteranServiceRequest: React.FC = () => {
<div className={styles.longText}>
<TextField
label="Age"
type="number"
variant="outlined"
placeholder="Enter your age"
{...register("age", {
required: "Age is required",
min: {
value: 0,
message: "This field must be positive",
pattern: {
// Only allow up to 2 digits
value: /^[0-9]+$/,
message: "This field must be a number",
},
})}
required
Expand Down

0 comments on commit 3c2a5aa

Please sign in to comment.