This is a solution to the Multi-step form challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- Complete each step of the sequence
- Go back to a previous step to update their selections
- See a summary of their selections on the final step and confirm their order
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page
- Receive form validation messages if:
- A field has been missed
- The email address is not formatted correctly
- A step is submitted, but no selection has been made
- You can change the placeholder's text color with "::placeholder" in css:
::placeholder{
color:hsl(231, 11%, 63%) ;
}
- If the user forgot to input one of the following then it would trigger a flag response to equal 0.
if(namee.value==""){
document.querySelector(".name-error").style.display="block";
document.querySelector(".name-input").style.border="1px solid hsl(354, 84%, 57%)";
input_error_flag = 0;
}
if(email.value == ""){
document.querySelector(".email-error").style.display="block";
document.querySelector(".email-input").style.border="1px solid hsl(354, 84%, 57%)";
input_error_flag = 0;
}
else if(!isEmail(email.value)) {
document.querySelector(".email-error").innerHTML="Please enter a valid email";
document.querySelector(".email-error").style.display="block";
document.querySelector(".email-input").style.border="1px solid hsl(354, 84%, 57%)";
input_error_flag = 0;
}
if(phone.value==""){
document.querySelector(".phone-error").style.display="block";
document.querySelector(".phone-input").style.border="1px solid hsl(354, 84%, 57%)";
input_error_flag = 0;
}
- You can remove arrow keys from input type number with:
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
appearance: none;
}
But for Mozilla it only works if you add the following code:
input[type=number] {
-moz-appearance: textfield;
}
which also generates an error highlight on visual studio code recommending us not to use it because it's nonstandard.
Before noticing that there was an already resized mobile background picture I tried to figure a way of resizing the already existing desktop background picture so only the desired part shows. I learned that you can "crop" an image by using:
img-test{
object-fit: cover;
object-position: -20% 0;
}
Line height should be set to 100% so all the padding comes from the button settings instead of the text
button{
line-height: 100%;
}
Use this section to outline areas that you want to continue focusing on in future projects. These could be concepts you're still not completely comfortable with or techniques you found useful that you want to refine and perfect.
- Example resource 1 - This helped me for XYZ reason. I really liked this pattern and will use it going forward.
- Example resource 2 - This is an amazing article which helped me finally understand XYZ. I'd recommend it to anyone still learning this concept.
Note: Delete this note and replace the list above with resources that helped you during the challenge. These could come in handy for anyone viewing your solution or for yourself when you look back on this project in the future.
- Website - Add your name here
- Frontend Mentor - @yourusername
- Twitter - @yourusername
Note: Delete this note and add/remove/edit lines above based on what links you'd like to share.
This is where you can give a hat tip to anyone who helped you out on this project. Perhaps you worked in a team or got some inspiration from someone else's solution. This is the perfect place to give them some credit.
Note: Delete this note and edit this section's content as necessary. If you completed this challenge by yourself, feel free to delete this section entirely.