Skip to content

London | 26-ITP-Sep | Mahir Shah | Sprint 1 | Form Controls - #1495

Open
MahirShah300 wants to merge 5 commits into
CodeYourFuture:mainfrom
MahirShah300:feature/form-controls
Open

MahirShah300 wants to merge 5 commits into
CodeYourFuture:mainfrom
MahirShah300:feature/form-controls

Conversation

@MahirShah300

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

CYF-1004

Changelist

Added the code to ask and validate name and email. Used regex to validate name. Added dropdown for colour and size.

@netlify

netlify Bot commented Sep 10, 2026

Copy link
Copy Markdown

Deploy Preview for cyf-onboarding-module ready!

Name Link
🔨 Latest commit 9a71def
🔍 Latest deploy log https://app.netlify.com/projects/cyf-onboarding-module/deploys/6aa80ad3d9b8f80008ba5387
😎 Deploy Preview https://deploy-preview-1495--cyf-onboarding-module.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
2 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 86 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@MahirShah300 MahirShah300 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 10, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly there. The validation itself is well done: the name pattern accepts accented and non-Latin letters and rejects spaces-only input, the email uses the right input type, and both dropdowns start on a "Please select" option so required can actually do its job. Small, clearly described commits too, and the Netlify Lighthouse audit shows Accessibility at 100.

One thing stops this being Complete: there is no way to submit the form. Open the deploy preview, fill in nothing and try to submit it. What happens, and what element is missing? Until a user can trigger submission, none of the required, pattern or type="email" checks ever run for them.

Add the Needs Review label again once you've pushed and I'll take another look.

Comment thread Form-Controls/index.html
<option value="xxl">Extra Extra Large</option>
</select>
</div>
</form>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The form ends here without any button. Try filling it in on the deploy preview and submitting. What happens? Which element would let the user do that, and would the browser then run the validation you've written?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing happens because I haven't added a button. Adding the button, then when clicking it the browser validates the inputs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's it. The button is what lets the browser run the checks you'd written.

Comment thread Form-Controls/index.html
name="name"
required
minlength="2"
pattern="(\p{L}\p{M}*)+(['\- ](\p{L}\p{M}*)+)*"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good pattern. I tried Är, ää, O'Brien, Anne-Marie and 李明 and they all pass, while and A are rejected. One question: what does minlength="2" add that the pattern doesn't already do on its own?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern accepts single characters and the requirement is at least 2 non space characters, which is why I used the min length

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good answer. The pattern controls which characters, minlength controls how many. Both are needed.

Comment thread Form-Controls/index.html
<div>
<label for="colour">Colour</label>
<select name="colour" id="colour" required>
<option value="">Please select</option>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting the dropdown on an empty "Please select" option is the right way to make required work on a select. Well done.

Comment thread Form-Controls/index.html
['\- ] 1 space ' - character. (\p{L}\p{M}*)+)* then
0 or more of any letter again -->
</div>
<br />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These <br /> tags are only there to space the fields out. What would you reach for instead of line breaks to control spacing? (Not required for this task.)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using CSS with margins

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Margins in CSS, whenever you next style a form.

@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 14, 2026
@MahirShah300 MahirShah300 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 14, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submit button in, validation runs, and your answers to the three questions are all right. Marking this Complete.

One small thing for the next time you touch this file: Prettier now flags line 66, the new <br> doesn't match the <br /> style used elsewhere in the file. Running the formatter once more would sort it. Not holding Complete for that.

@abdishakoor-dev abdishakoor-dev added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants