I used sass on this one. Also did mobile first this time. A lot better
Design comparison
Solution retrospective
I found the validation part of the project difficult. Honestly it is still buggy in my opinion. After you've completed the fields if you go back to one and enter wrong data, the label and border of input turn red, but does not display error message anymore. If anyone could help me with that I would appreciate it.
Community feedback
- @mmubashshirPosted over 1 year ago
Hi,
Answering your question use a span below each of those input fields and hide them using display none.
- You can first check if inputs are empty, if not using DOM, style the element as red and now unhide the span element with text "The fields is required"
- If they are not empty, you can check for validation, and if invalid you can do similar job with DOM to show invalid states
- Lastly, only run the function to calculate the age , if they are not empty and if they are valid
Good job done with responsiveness for mobile, couple of things to note
- Firstly, with this type of designs don't initialize a definite height, so whenever you shift to mobile size the height is automatically is adjusted.
- And giving an overall padding on all sides will take care of spacing on the bottom.
- center alignment, I think was not required, reducing width along with screen size does the job
- You could use input type="number" which wont take any text into consideration
- Using flex and gap between those elements is a good one
Congratulations, keep it up buddy 😊
0@jwren4170Posted over 1 year ago@mmubashshir, Thanks for responding. I thought about using number type on inputs, but looking at the design(jpgs) I didn't think they had used them that way. So I wanted to stay as close to that as possible.
I'm not sure what you mean about the validation? I'm trying to add reset form functionality, but when I do, yes the input values are cleared but the validation styling doesn't go away. And if you try to enter new values, wrong ones, you get the error styling, but not the message.
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord