JS Form Validation: Clarify form validation requirements #27576
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because
A surprisingly common occurrence I've seen in the community is confusion as to what the Form Validation with JS lesson's instruction to do "all" validation in JS actually means.
Some have interpreted this to mean that you cannot even use different input types with the form having the
novalidate
attribute. Meaning they use only text inputs and manually validate every small detail inc. input format.Instead, I believe the intent is to disable automatic HTML validation and to handle it via JS instead, where the learner can still use different input types (just needing to use the constraint validation API to check and report validity).
This PR
novalidate
on the<form>
element, and use JS to check and report validity via the constraint validation API as was taught in the lesson.### Practice
block into the### Assignment
block.Issue
Closes #27316
Additional Information
The decision to combine
### Practice
and### Assignment
came from mdlint not likingPractice
being a###
instead of####
. However, setting it as a####
looks odd given it's a block heading where the block already has####
subheadings.The
Practice
material is also essentially an assignment anyway, so I felt it might as well be combined with theAssignment
section as well.I did this combination in its own commit - so if this would preferably be done in a separate PR, I can always revert it to make the main change for
novalidate
and open a new PR for the section combination. Equally, if it would be preferable to just keep the section structure separated as is and ignore the### Practice
lint error via a comment, a revert could easily handle that as well.Pull Request Requirements
location of change: brief description of change
format, e.g.Intro to HTML and CSS lesson: Fix link text
Because
section summarizes the reason for this PRThis PR
section has a bullet point list describing the changes in this PRIssue
section