C. The method attribute should be 'get' instead of 'post'
D. The label should come before the input for accessibility
Solution
Step 1: Check label and input order for accessibility
Labels should appear before inputs or wrap them to help screen readers.
Step 2: Confirm label's for attribute matches input's id
The label's for='email' matches input's id='email', so linking is correct.
Final Answer:
The <label> should come before the input for accessibility -> Option D
Quick Check:
Label before input improves accessibility [OK]
Hint: Place labels before inputs for better accessibility [OK]
Common Mistakes:
Ignoring label position and accessibility
Thinking input tags always need a closing slash
Changing method without reason
5. You want to create a form that collects a user's name and email, ensures both fields are required, and sends data using POST to '/register'. Which of the following is the best complete form code?
hard
A. \n \n \n Submit\n
B. \n Name:\n \n Email:\n \n Register\n
C. \n \n \n Send\n
D. \n Name\n \n Email\n \n Register\n
Solution
Step 1: Check form attributes for sending data
The form must use action='/register' and method='post' to send data correctly.
Step 2: Verify input fields and required attribute
Inputs for name and email have matching labels, correct types, and required to ensure user fills them.
Step 3: Confirm button type and labels
The submit button has type='submit' and labels use for linked to inputs for accessibility.
Final Answer:
Complete form with action, method, required fields, and labels -> Option B
Quick Check:
Form with required fields and POST [OK]
Hint: Use required inputs and method='post' with labels for best form [OK]
Common Mistakes:
Using GET instead of POST for sensitive data
Missing required attribute on inputs
Labels not linked to inputs
Omitting method attribute
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.