Repository navigation
add solution - #1976
add solution#1976olena0112 wants to merge 3 commits into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your code has a critical requirement violation. The task explicitly requires getting inputs from the form tag, but you're using document.querySelectorAll('input') which selects ALL inputs on the page. This doesn't meet the requirement "Get all inputs from form tag on the page."
To fix this, scope your selector to the form element. You can use either:
document.querySelector('form').querySelectorAll('input')
ordocument.querySelector('form').elements
This ensures you're only targeting inputs within the form, as required by the task description.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| 'use strict'; | ||
|
|
||
| // write code here | ||
| const inputs = document.querySelectorAll('input'); |
There was a problem hiding this comment.
The requirement specifies to get inputs from the 'form' tag, but this selects ALL inputs on the page. Should use document.querySelector('form').querySelectorAll('input') or document.querySelectorAll('form input') instead.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your code is passing 8 tests for the sign-up form, but there are 4 failing tests for the sign-in form that need to be fixed. The sign-in form inputs (#sign-in-email and #sign-in-password) are missing both placeholder attributes and associated <label> elements. You need to add placeholders and labels to the sign-in form following the same pattern you used for the sign-up form. Specifically: add placeholder attributes to the sign-in inputs (capitalized from the input's name), and create <label> elements with for attributes matching the input IDs and class="field-label". The tests expect labels and placeholders on both forms, not just one.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved! The code correctly implements all the required functionality - it iterates over all forms on the page, creates labels with the proper field-label class, sets the for attribute to match input IDs, and generates placeholders from the input names. Great job handling both sign-up and sign-in forms by using document.querySelectorAll('form'). As a learning note, keep in mind that this solution depends on having proper name attributes on all form inputs - if an input lacks a name attribute, accessing input.name[0] would cause an error. This is a good example of why defensive coding with checks like input.name before accessing its properties can be helpful. Well done on meeting all the checklist requirements!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
https://olena0112.github.io/js_task_fix_form_DOM/