Structure d’un formulaire HTML Flashcards
What is the main tag used to create a form in HTML?
<form>
## Footnote
The <form> tag is essential for creating forms in HTML.
</form></form>
What does the ‘name’ attribute in a form specify?
This attribute helps identify the form when submitted.
What are the two methods available for form submission?
- get
- post
‘get’ sends data via URL, while ‘post’ sends data to the server.
What is the purpose of the ‘action’ attribute in a form?
Specifies the URL of the program to process the data
This attribute determines where the form data is sent upon submission.
What HTML tag is used for a simple text input field?
<input></input>
This tag allows users to enter text.
Which tag is used for creating a password input field?
<input></input>
This tag hides the input text for security.
How do you create a checkbox input in HTML?
<input></input>
This tag allows users to select multiple options.
What is the HTML tag for creating radio buttons?
<input></input>
Radio buttons allow selection of one option from a set.
What is the HTML structure for a dropdown list?
<select></select>
Dropdown lists enable users to select one option from a list.
What HTML tag is used for a multi-line text input?
<textarea>
## Footnote
This tag allows users to enter larger amounts of text.
</textarea>
What is an example of local validation using JavaScript?
<form>
## Footnote
This ensures the form is validated before submission.
</form>
What does the ‘required’ attribute do?
Makes the field mandatory
Users must fill out this field before submitting the form.
What is the purpose of the ‘placeholder’ attribute?
Provides temporary guidance text for the user
This text disappears when the user starts typing.
What does the ‘pattern’ attribute validate?
The format of the entered data
This is useful for formats like postal codes.
What is the difference between ‘readonly’ and ‘disabled’ attributes?
- readonly: Field is read-only
- disabled: Field is disabled and cannot be interacted with
Both attributes affect user interaction with form fields.
What do ‘size’ and ‘maxlength’ attributes control?
- size: Controls the visible width of the input
- maxlength: Limits the number of characters
These attributes help manage user input.
How can CSS styles be applied to form elements?
Using styles like:
css input, select, textarea { border: 1px solid #ccc; padding: 8px; margin: 5px; }
This example demonstrates basic styling for form elements.
What is the first step in creating a form?
Insert a <form> tag into the page
This establishes the starting point for the form structure.
What should be added after the <form> tag?
Sections and fields (using tables or divisions)
This organizes the content within the form.
What is the last step in configuring a form?
Link the form to a processing program via the ‘action’ attribute
This is crucial for data submission.