In the last two posts we discussed about html text field forms and form attributes.Although all normal forms offer text fields to be filled but sometimes you need to create other types of forms also or you need to add other types of forms also which provide specific option to be chosen such as checkboxes, radio buttons and drop down lists.And there is another type of form also which lets you send an e-mail to a specific mail address.In this post, we'll discuss only check-boxes , radio buttons and drop down lists.For a mail-to form you can go to our mail-to form post.
-
Check Boxes:Check boxes are commonly used in survey forms in which you need to choose among
3-4 options but number can vary on choice.So how can we create such boxes.The answer is very difficult to understand.It includes a tremendous
knowledge of HTML.So keep your focus here.Here we go..
Just change the input type to "checkbox".Those who don't know about the input tag can visit our post HTML forms
What it looks like is :- <form action="">
I own a bike: <input type="checkbox" name="vehicle" value="Bike">
I own a car: <input type="checkbox" name="vehicle" value="Car">
I own an airplane: <input type="checkbox" name="vehicle" value="Airplane">
</form>
Was it difficult for you....I dont think so
Now its browser version
-
Radio ButtonsThese buttons are normally used for polling.These are simple enough to create.Just
change the input type to "radio".And if you want one button to be pre-selected then add a simple text phrase checked="checked" in the input tag of that
button.I am only showing you the browser version of that button.
Button pre-selected
Button not preselected -
Drop-Down listYou have always noticed this type of list when you'd have to select an year or a
state in various forms.You can also create one without any problem.But the syntax is quite different fron types of forms still not to worry.
What will you have to do is to start the list with <select> tag and then go on writing down your options using the <option> tag.Don;t worry--i am
not gonna leaving you without giving an example.Here is the format....
<form>
<select name="year"> (you can give it any name)
<option value="2014">2014
</option> <option value="2013">
2013</option>
<option value="2012">2012</option>>
<option value="2011">2011</option>
</select>
</form>
Here is its browser version.
If you want any one of them to be pre-displayed in the list then just add selected="selected" phrase in the option tag of that option.
This is all for this post.To get info about mail to form check our mail-to post
Comments
Post a Comment
Comment on articles for more info.