Laravel / Views / Forms Example
Form and Input Tags
-
1. Form Elements
The following list shows some of the form elements that we can use while creating a form.
#1) LabelDescription: A label represents the caption for the form element.
Example: Generating a label for the first name.
#2) Text InputDescription: A text input field is a single line input field that allows the user to enter text.
Example: Generating a text input field for the first name.
Show #4) Number InputDescription: The number of input field allows the user to enter a numeric value.
Example: Generating a number input field for age.
#5) Date InputDescription: A date input field allows the user to select a date.
Example: Generating a date input field for the birth date.
#6) File InputDescription: A file input field allows the user to upload a file.
Example: Generating a file select field for certificate copy upload.
#7) Hidden InputDescription: A hidden input field allows the developer to add data when the user submits the form, and the user cannot see or modify these data.
Example: Generating a hidden input field for student id that has the value 220.
#8) TextareaDescription: A textarea allows the user to enter a long text. It may contain multiple lines of text.
Example: Generating a textarea for address.
#9) Email InputDescription: An email input field allows the user to enter an email address. It automatically validates the email format.
Example: Generating an email input field.
#10) Password InputDescription: A password input field allows the user to enter a password. The entering characters are masked.
Example: Generating a password input field.
#11) Drop-down List or Select BoxDescription: A drop-down list or select box allows the user to select an option from a list of options.
Example: Generating a drop-down list for the title.
#12) Radio Button InputDescription: A radio button allows the user to select a single option from a list of two or more mutually exclusive options.
Example: Generating a radio button input field for gender.
#13) Checkbox InputDescription: A checkbox allows the user to select one or more options from a given set of options.
Example: Generating a checkbox input field for colours.
#14) Buttonsa) Normal Button
Description: A normal button is a clickable button.
Example: Generating a normal button.
b) Submit Button
Description: A submit button allows the user to submit form data to the server-side of the application.
Example: Generating a submit button.
c) Reset Button
Description: A reset button allows the user to set form fields to its original values.
Example: Generating a reset button.
-
2. Form Tag
1. form tag is used to create a form
2. All form inputs must be written inside the form tag
3. A form must have 'action' attribute for sending the user entered data to a server
-
3. Form Example
Laravel Forms Tutorial Student Registration Form