SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
Programming and Development Tools                           Web Programming




                                                              UNIT


                                                        2.11
Web Programming
Forms




 OBJECTIVES
 This unit helps you to add Forms to your Web page to get the data from the
 user.
 At the end of this unit, you will be able to
            Add a Form to your Web page.
            Add a Text Field to a Form.
            Add a Radio Button to a Form.
            Add a Text Area to a Form.
            Add a Check Box to a Form.
            Add a Drop-Down List Box to a Form.
            Add a Button to a Form.




Benchmark standard
          Design Web pages with Forms to get the data from the user for
          further processing.




Forms                                                             2.11-1
Programming and Development Tools                             Web Programming




Let us Revise!

 1. Define Frame.
 2. Name the different types of Framesets.
 3. Write the code segment to create a Web page with horizontal frames..
 4. State the use of <NOFRAMES> tag.
 5. Write the code segment to create a Web page with Inline Frame.


 Introduction
 You would have filled up a Form in many places. For example, when joining
 the school you would have given the particulars about yourself such as Name,
 Age and Date of Birth in a Form. Similarly, the Form in HTML is an element
 used to get the data from the user. The Form is like a container having
 elements called controls. The controls used to get data from the user are Text
 Field, Check box, Radio button, Text area and Drop-down List box.


 2.11.1 Designing the Form
 A Form should be carefully designed keeping in mind certain conditions like
 the questions to be asked and the controls to be used to get the data from the
 user.
 Identifying the questions
 Before adding a form, you should know the requirement such as the data to
 be received, the control to be used to receive the data and placement of the
 controls in the Form element. For example, the data to be received from a
 student applying for admission in a college are Name, Date of Birth, Address,
 Grade obtained in his schooling, etc.


      Hands-On!

 The following example illustrates the use of forms in a Webpage.
 Open the HTML file Form.html in Internet Explorer.
 The code in Form.html file is given below:
 <HTML>
 <HEAD>
         <TITLE> Form </TITLE>
 </HEAD>
 <BODY Bgcolor="LightYellow">

 Forms                                                               2.11-2
Programming and Development Tools                         Web Programming


<FORM> <FONT Size="4">
<H2 Align="Center"> ABC College of Engineering </H2>
<H2 Align="Center"> Application Form </H2>


1) Name
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;:&nbsp;&nbsp;
<INPUT Type="Text" Name="Name" Size="60">         <BR><BR>

                                     Adds a Text Box
2) Date of Birth
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;:&nbsp;&nbsp;
<INPUT Type="Text" Name="DOB"> <BR><BR>
                                     Adds a Text Box

3)      Sex
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;
<INPUT Type="Radio" Name="Gender">Male
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT Type="Radio" Name="Gender">Female <BR><BR>

                                    Adds a Radio Button
4)      Nationality
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;
<INPUT Type="Text" Name="Nation" Size="40"> <BR><BR>
                                     Adds a Text Box

5)      Parent/Guardian Name
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;
<INPUT Type="Text" Name="Name" Size="60"> <BR><BR>

                                       Adds a Text Box
6)      Address <BR>



Forms                                                          2.11-3
Programming and Development Tools                                      Web Programming


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<TextArea Rows="5" Cols="50"></TextArea><BR><BR>


7)      Extra Curricular Activities                 Adds a Text Area

&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;
<INPUT Type ="Checkbox" Name="Extra"> Football
<INPUT Type ="Checkbox" Name="Extra"> Hockey
<INPUT Type ="Checkbox" Name="Extra"> Badminton
<INPUT Type ="Checkbox" Name="Extra"> Tennis
<INPUT Type ="Checkbox" Name="Extra"> Others <BR><BR>

                                                Adds a Check Box
8)      Grade obtained
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp
;&nbsp;
Mathematics
<INPUT Type="Text" Name="Grade1" Size="10">
&nbsp;&nbsp;&nbsp;Physics
<INPUT Type="Text" Name="Grade2"
Size="10">&nbsp;&nbsp;&nbsp;
Chemistry <INPUT Type="Text" Name="Grade3" Size="10">
&nbsp;&nbsp;&nbsp; <BR><BR>


9)      Course Applied for
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;:&nbsp;&nbsp;
<SELECT>                            Adds a Drop-Down List Box
<OPTION Value="Mech" Name="Mech">Bachelor of Mechanical
Engineering
<OPTION Value="Civil" Name="Civil">Bachelor of Civil
Engineering
<OPTION Value="Electrical" Name="Electrical">Bachelor of
Electrical Engineering


Forms                                                                       2.11-4
Programming and Development Tools                           Web Programming


<OPTION Value="Electronics" Name="Electronics">Bachelor
of Electronics Engineering
</SELECT>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;
<BUTTON Type="Submit">Submit</BUTTON>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BUTTON Type="Reset">Reset</BUTTON>                       Adds a Button




</FONT>
</FORM>
</BODY>
</HTML>
                             Code Sample 2.11.1


The Web page shown in Figure 2.11.1 is displayed in the browser window.




                                                             Text Box


                                                           Radio Button




                                                            Text Area



                                                            Check Box




                                                    Drop-Down List Box

                                    Button



              Figure 2.11.1: A Web Page Containing a Form


Forms                                                              2.11-5
Programming and Development Tools                                 Web Programming


The Web page shown in Figure 2.11.1 contains an application form displayed
in it. When the Submit button is clicked after entering the values in the
controls, the entered data are passed to a program that takes care of further
processing. In this unit you will be learning to add Forms and controls to your
Web page.
A Form is added to a Web page using the <FORM> tag. The <FORM> tag has
two important attributes. They are Action and Method.
        The URL of the program file that processes the data entered by the
        user is assigned to the Action attribute.
        The Method attribute can have either Get or Post as its value. Get is the
        default value. If Method = “Get”, the names and values of the data
        entered are send to the program along with the URL specified in the
        Action attribute. If Method = “Post”, the names and values of the data
        entered are send to the program as separate entity.



        Self-Check Exercise 2.11.1

Say true or false:
1. <FORM> tag is used to add a form to a Web page.
2. Action is the only attribute used with <FORM> tag.
3. The two values of the Method attribute are Get and Post.



      Activity 2.11.1

1. Draw a form to enter your personal details (Bio-Data).


2.11.2 Working with Form Elements
The different controls that can be added to a Form are Text Fields, Radio
buttons, Text area, Check box, Drop-down List box and Push buttons. Most of these
controls can be added to the form using the <INPUT> tag along with Type
attribute.
The Text Field
The Text Field is a control that is used to get a text from the user and to
display a text to the user. It can be added to a form using the <INPUT> tag
along with the Type attribute.
The following are the codes used to display the Text Fields shown in Figure
2.11.1.
<INPUT Type="Text" Name="Name" Size="60"> <BR><BR>
<INPUT Type="Text" Name="DOB"> <BR><BR>
<INPUT Type="Text" Name="Nation" Size="40">
<INPUT Type="Text" Name="P_Name" Size="60">

Forms                                                                   2.11-6
Programming and Development Tools                                 Web Programming


<INPUT Type="Text" Name="Grade1" Size="10">
<INPUT Type="Text" Name="Grade2" Size="10">
<INPUT Type="Text" Name="Grade3" Size="10">
The attribute Type = “Text” instructs the browser to display a Text Field. The
attribute Name = “Name” assigns a name to the Text Field for future use. The
attribute Size = “60” specifies the width of the Text Field. The attributes of the
<Input> tag related to the Text Field are given in Table 2.11.1.


        Attribute                     Value                       Use
          Type             Text                        Displays a Text Field
                           Password                    Displays a Text Field that
                                                       is used to enter secret
                                                       information. The text in
                                                       this field appears as
                                                       asterisks (*).
         Name              Any Text                    The value given will be
                                                       assigned to the Name
                                                       attribute that can be used
                                                       for future reference.
          Size             Any Integer value           Defines the width of the
                                                       Text Field.
        Maxlength          Any Integer value           Defines the maximum
                                                       number of characters that
                                                       can be typed in a Text
                                                       Field.
        Readonly           ---                         Can read from the Text
                                                       Field but you cannot write
                                                       in the Text Field.
          Value            Any String value            The value given in Value
                                                       attribute will be displayed
                                                       inside the Textbox by
                                                       default.
        Disabled           ---                         Makes the control visible
                                                       but cannot be used.
        Table 2.11.1: Attributes of <INPUT> tag related to Text Field


The Radio Button
The Radio Button is a control that is used to display an option to the user. If the
option is applicable to the user, he can select the option by clicking it. Two or
more Radio Buttons can be grouped together. The user can select only one
option in that group. Radio Button can be added to a form using the <INPUT>
tag along with the Type attribute.



Forms                                                                   2.11-7
Programming and Development Tools                                Web Programming


The following are the codes used to display the Radio Buttons shown in
Figure 2.11.1.
<INPUT Type="Radio" Name="Gender" Value=”M”>Male
<INPUT Type="Radio" Name="Gender" Value=”F”>Female
The attribute Type = “Radio” instructs the browser to display a Radio Button.
The attribute Name = “Gender” assigns a name to the Radio Button for future
use. The two Radio Buttons are grouped together by giving the same value
for the Name attribute. The value given in Value attribute will be send to the
URL specified in the Form’s Action attribute, if the button is selected. The
attributes of the <Input> tag related to the Radio Buttons are given in Table
2.11.2.


        Attribute                   Value                        Use
          Type             Radio                      Displays a Radio Button.
         Name              Any String value           The value given will be
                                                      assigned to the Name
                                                      attribute that can be used
                                                      for future reference.
        Checked            ---                        Indicates that the option
                                                      remains selected when
                                                      the form is opened.
        Disabled           ---                        Makes the control visible
                                                      but cannot be used.
          Value            Any String value           The value given in Value
                                                      attribute will be send to
                                                      the URL specified in the
                                                      Form’s Action attribute, if
                                                      the button is selected.
     Table 2.11.2: Attributes of <INPUT> tag related to Radio Buttons


The Text Area
The Text Area is a control that is used to get a text from the user and to display
a text to the user. The difference between a Text Field and a Text Area is that
a Text Field can accept or display only one line of text. But, a Text Area can
accept or display more than one line of text. It can be added to a form using
the <TEXTAREA> tag and Rows and Cols attributes.
The following is the code used to display the Text Area shown in Figure
2.11.1.
<TextArea Rows="5" Cols="50"></TextArea>
The attributes Rows = “5” and Cols=”50” instructs the browser to display a
Text Area of 5 rows and 50 columns. The attributes of the <TEXTAREA> tag
are given in Table 2.11.3.

Forms                                                                  2.11-8
Programming and Development Tools                                          Web Programming



        Attribute                       Value                            Use
          Rows                 Any Integer value              Specifies the number of
                                                              rows visible in the Text
                                                              Area
           Cols                Any Integer value              Specifies the number of
                                                              columns visible in the
                                                              Text Area
          Name                 Any String value               The value given will be
                                                              assigned to the Name
                                                              attribute that can be used
                                                              for future reference.
        Readonly               ---                            Can read from the Text
                                                              Area but you cannot write
                                                              in the Text Area.
         Disabled              ---                            Makes the control visible
                                                              but cannot be used to
                                                              modify the text.
                  Table 2.11.3: Attributes of <TEXTAREA> tag


        Lab Exercise

Lab Exercise 1: Open D11_1.html in Internet Explorer. The following code will be present in
D11_1.html.

<HTML>
<HEAD>
     <TITLE>
          STUDENT INFORAMTIONS
     </TITLE>
</HEAD>
<BODY>
     <H1 Align =CENTER> STUDENT INFORMATIONS </H1>
     <BR>
     <FORM>
          NAME:
          <INPUT Type ="TEXT" NAME="TXT_NAME" Size=5
          Maxlength=5 ><BR><BR>

                PASSWORD:
                <INPUT Type ="PASSWORD" Name = "TXT_NAME"
                Size = 5 Maxlength=5><BR><BR>

                ADDRESS: <TEXTAREA Name = "TXT_ADDRESS" Rows=4
                Cols=30></TEXTAREA><BR><BR>

                PHONE : <INPUT Type = "TEXT" Name="TXT_PHONE"


Forms                                                                             2.11-9
Programming and Development Tools                                                  Web Programming


          Size=8><BR><BR>
     </FORM>
</BODY>
</HTML>

    1.   Name attributes which are used in input tag.
    2.   Identify the attribute which is used to specify the input type.
    3.   Identify the attribute which is used to set the length of the text box.
    4.   Observe the difference between size and maxlength.
    5.   Identify the tag which is allows to enter the multiline text entry.
    6.   Name the attribute which are used in textarea.

Lab Exercise 2: Open D11_1.html in Internet Explorer.
   1. View the source code in the Notepad.
   2. Increase the size of the Name textbox to 10.
   3. Insert value into Name textbox and observe the difference.
   4. Change the Password textbox type to password.
   5. Increase the no of columns of the textarea to 40.
   6. Decrease the no of row of the textarea to 3.


         Self-Check Exercise 2.11.2

Name the tag and attribute to be used for the following:
1. To add a Text Field whose width is 9 characters and maximum number of characters that
    can be entered is 25.
2. To add 2 Radio Buttons of same group displaying Yes and No. The values of the 2 Radio
    Buttons should be “Y” and “N”.
3. To add a Text Area of 6 rows and 50 columns.


The Check Box
The Check Box is a control that is used to display an option to the user. If the
option is applicable to the user, he can select the option by clicking it. Two or
more Check Boxes can be grouped together. The user can select any number
of Check Boxes in that group. Check Box can be added to a form using the
<INPUT> tag along with the Type attribute.
The following are the codes used to display the Radio Buttons shown in
Figure 2.11.1.
<INPUT Type ="Checkbox" Name="Extra"> Football
<INPUT Type ="Checkbox" Name="Extra"> Hockey
<INPUT Type ="Checkbox" Name="Extra"> Badminton
<INPUT Type ="Checkbox" Name="Extra"> Tennis
<INPUT Type ="Checkbox" Name="Extra"> Others
The attribute Type = “Checkbox” instructs the browser to display a Check Box.
The attribute Name = “Extra” assigns a name to the Check Box for future use.

Forms                                                                                   2.11-10
Programming and Development Tools                                         Web Programming


The five Check Boxes are grouped together by giving the same value for the
Name attribute. The attributes of the <Input> tag related to the Check Boxes
are given in Table 2.11.4.
         Attribute                   Value                              Use
           Type               Checkbox                       Displays a Check Box.
           Name               Any String value               The value given will be
                                                             assigned to the Name
                                                             attribute that can be used
                                                             for future reference..
         Checked              ---                            Indicates that the option
                                                             remains selected when
                                                             the form is opened.
         Disabled             ---                            Makes the control visible
                                                             but cannot be used.
           Value              Any Text                       The value given in Value
                                                             attribute will be send to
                                                             the URL specified in the
                                                             Form’s Action attribute, if
                                                             the button is selected.
        Table 2.11.4: Attributes of <INPUT> tag related to Check Boxes


          Note

The difference between a Radio Button and a Check Box is that only one option can be
selected in a group of Radio Buttons whereas more than one option can be selected in a group
of Check Boxes.


The Drop-Down List Box
The Drop-Down List Box is a control that is used to display a list of items in a
rectangular box from which the user can select an option. If the option is
applicable to the user, he can select the option by clicking it. Drop-Down List
Box can be added to a form using the <SELECT> tag along with <OPTION>
tag.
The following are the codes used to display the Drop-Down List Box shown in
Figure 2.11.1.
<SELECT>
    <OPTION Value="Mech" Name="Mech">Bachelor of
          Mechanical Engineering
    <OPTION Value="Civil" Name="Civil">Bachelor of Civil
          Engineering
    <OPTION Value="Electrical" Name="Electrical">Bachelor
          of Electrical Engineering

Forms                                                                           2.11-11
Programming and Development Tools                              Web Programming


    <OPTION Value="Electronics"
          Name="Electronics">Bachelor of Electronics
          Engineering
</SELECT>
The <SELECT> tag instructs the browser to display a Drop-Down List Box.
The <OPTION> tag is used to display the items inside the Drop-Down List
Box. In the above example, the four items are grouped together in a Drop-
Down List Box by giving the same value for the Name attribute of the
<OPTION> tag. The item to be displayed in the Drop-Down List Box is
assigned to the Value attribute of the <OPTION> tag. The attributes of the
<SELECT> tag are given in Table 2.11.5.
        Attribute                   Value                       Use
          Name             Any String value         The value given will be
                                                    assigned to the Name
                                                    attribute that can be used
                                                    for future reference.
          Size             Any Integer value        Specifies the number of
                                                    items visible in the Drop-
                                                    Down List Box.
        Disabled           ---                      Makes the control visible
                                                    but cannot be used.
         Multiple          ---                      Specifies that more than
                                                    one item can be selected.
                    Table 2.11.5: Attributes of <SELECT> tag


The attributes of the <OPTION> tag are given in Table 2.11.6.
        Attribute                     Value                    Use
         Selected          ---                      Specifies that this option
                                                    appears as the selected
                                                    option by default
          Value            Any Text                 The value given in Value
                                                    attribute will be send to
                                                    the URL specified in the
                                                    Form’s Action attribute, if
                                                    the option is selected.
        Disabled           ---                      Makes the option visible
                                                    but cannot be selected
                    Table 2.11.6: Attributes of <OPTION> tag


The Button
The Button is a control that is used to display a push button. The function of
the Push Button varies depending upon the type of the button. The button can

Forms                                                                2.11-12
Programming and Development Tools                                          Web Programming


be of 3 types. They are Submit button, Reset button and a Push button. The
Submit button sends the values entered by the user to the URL specified in
the Form’s Action attribute. The Reset button sets the values of all the
controls to their initial values. For the normal buttons, commands should be
given for the action to be taken if it is clicked. Buttons can be added to a form
using the <BUTTON> tag along with the Type attribute.
The following are the codes used to display the buttons shown in Figure
2.11.1.
<BUTTON Type="Submit">Submit</BUTTON>
<BUTTON Type="Reset">Reset</BUTTON>
The attribute Type = “Submit” instructs the browser to send the values entered
by the user to the URL specified in the Form’s Action attribute. The attribute
Type = “Reset” instructs the browser to set the values of all the controls to
their initial values. The attributes of the <BUTTON> tag are given in Table
2.11.7.


        Attribute                         Value                           Use
          Type                 Submit                         Instructs the browser to
                                                              send the values entered
                                                              by the user to the URL
                                                              specified in the Form’s
                                                              Action attribute.
                               Reset                          Instructs the browser to
                                                              set the values of all the
                                                              controls to their initial
                                                              values.
                               Button                         Instructs the browser to
                                                              execute the commands
                                                              given for the action to be
                                                              taken if it is clicked.
          Name                 Any Text                       The value given will be
                                                              assigned to the Name
                                                              attribute that can be used
                                                              for future reference.
         Disabled              ---                            Makes the control visible
                                                              but cannot be used.
          Value                Any Text                       Specifies the initial value
                                                              to the button.
                    Table 2.11.7: Attributes of <BUTTON> tag

        Lab Exercise

Lab Exercise 3: Open D11_2.html in Internet Explorer. The following code will be present in
D11_2.html.

Forms                                                                             2.11-13
Programming and Development Tools                                     Web Programming


<HTML>
<HEAD>
     <TITLE>
          HOBBIES
     </TITLE>
</HEAD>
<BODY>
     <H3> CHOOSE YOUR HOBBIES </H3>
     <FORM>
            <INPUT Type ="CHECKBOX" Name =                      "CHK_HOBBY"
           Value="SONGS" > Hearing Songs
            <INPUT Type ="CHECKBOX" Name =                      "CHK_HOBBY"
           Value="GAMES" >Playing Games
            <INPUT Type ="CHECKBOX" Name =                      "CHK_HOBBY"
           Value="BOOKS" > Reading Books
            <INPUT Type ="CHECKBOX" Name =                      "CHK_HOBBY"
           Value="TRAVELLING"> Travelling                       <BR> <BR> <BR>

               <H3> CHOOSE YOUR PET </H3>
               <INPUT Type="RADIO" Name="PET" Value ="DOG"
               Checked> Dog

               <INPUT Type="RADIO” Name="PET" Value ="CAT"
               Checked> Cat

               <INPUT Type="RADIO" Name="PET" Value ="DOVE"
               Checked> Dove <BR><BR>

               <H3> CHOOSE YOUR FAVOURATE GAME </H3>
               <SELECT Name ="FOOD" Size=3>
                    <OPTION > FOOTBALL
                    <OPTION> HOCKEY
                    <OPTION> TABLE TENNIS
                    <OPTION> TENNIS
                    <OPTION> SWIMMING
               </SELECT>
               <BR><BR>

                <INPUT Type="SUBMIT" Value ="SUBMIT">
                <INPUT Type="RESET" Value ="RESET"><BR>
      </FORM>
</BODY>
</HTML>
   1. Locate the input type which is used to choose more than one option.
   2. Name the input type which is used to choose single option.
   3. Identify the tag which is used to display the drop-down menu options.
   4. Name attributes which are used in <SELECT>.




Forms                                                                         2.11-14
Programming and Development Tools                                          Web Programming


Lab Exercise 4: Write a HTML code to display the output as given in the following Figure
2.11.2 using <FORM> tag.




                     Figure 2.11.2: Student Mark Sheet Form




Forms                                                                            2.11-15
Programming and Development Tools                                          Web Programming


Lab Exercise 5: Write a HTML code to display the output as given in the following Figure
2.11.3 using <FORM> tag.




                    Figure 2.11.3: Student Informations Form




Forms                                                                            2.11-16
Programming and Development Tools                                          Web Programming


Lab Exercise 6: Write a HTML code to display the output as given in the following Figure
2.11.4 using <FORM> tag.




                  Figure 2.11.4: Master Card Application From




Forms                                                                            2.11-17
Programming and Development Tools                                          Web Programming


Lab Exercise 7: Write a HTML code to display the output as given in the following Figure
2.11.5 using <FORM> tag.




                           Figure 2.11.5: Online Booking




Forms                                                                            2.11-18
Programming and Development Tools                                          Web Programming


Lab Exercise 8: Write a HTML code to display the output as given in the following Figure
2.11.6 using <FORM> and <TABLE> tag.




                  Figure 2.11.6: Employment Application Form




Forms                                                                            2.11-19
Programming and Development Tools                                          Web Programming


Lab Exercise 9: Write a HTML code to display the output as given in the following Figure
2.11.7 using <FORM> and <FRAME> tag.




                      Figure 2.11.7: School Application Form


        Self-Check Exercise 2.11.3

Rewrite the following sentences correctly, if they are wrong:
1. The Checked attribute of the <INPUT> tag indicates that the checkbox option remains
selected when the form is opened.
2. The Multiple attribute of the <SELECT> tag specifies that more than one item can be
selected in a Drop-Down List Box.
3. Buttons can be added to a form using the <BUTTON> tag along with the Type attribute.


      Activity 2.11.2

1. Create a Web page that displays a form to enter user’s personal details
   (Bio-Data).
2. Save the HTML file as Activity1.html.




Forms                                                                            2.11-20
Programming and Development Tools                             Web Programming




     Activity 2.11.3

1. Create a Web page that explains the Form as shown in Figure 2.11.8.
2. Save the HTML file as Activity2.html.
3. The hyperlink Adding Controls at the bottom of the page should be linked to
   Add_Controls.html.




              Figure 2.11.8: A Web page Explaining the Form


     Activity 2.11.4

1. Create a Web page that explains the controls as shown in Figure 2.11.3.
2. Save the HTML file as Add_Controls.html.
3. The content of the same page is continued in Figure 2.11.9.




Forms                                                               2.11-21
Programming and Development Tools                        Web Programming




            Figure 2.11.9: A Web page Explaining the Controls




    Figure 2.11.10: Continuation of Web page shown in Figure 2.11.9

Forms                                                           2.11-22
Programming and Development Tools                                  Web Programming



         Technical Terminologies
 Form                            -   A Form in HTML is an element used to get
                                     the data from the user.
 Text Field                      -   The Text Field is a control that is used to get
                                     a text from the user and to display a text to
                                     the user.
 Radio Button                    -   The Radio Button is a control that is used to
                                     display an option to the user.
 Text Area                       -   The Text Area is a control that is used to get a
                                     text from the user and to display a text to the
                                     user.
 Check Box                       -   The Check Box is a control that is used to
                                     display an option to the user.
 Drop-Down List Box              -   The Drop-Down List Box is a control that is
                                     used to display a list of items in a rectangular
                                     box from which the user can select an option.
 Button                          -   The Button is a control that is used to display
                                     a push button.


 Summary
 In this unit, you learnt that
            The Form is like a container containing elements called controls.
            Text Field, Check box, Radio button, Text area and Drop-down List box
            are some of the controls used to get data from the user.
            The <FORM> tag has two important attributes namely, Action and
            Method.
            Text Field, Radio Button and Check Box can be added to a form
            using the <INPUT> tag along with the Type attribute.
            Text Area can be added to a form using the <TEXTAREA> tag
            and Rows and Cols attributes.
            Drop-Down List Box can be added to a form using the <SELECT>
            tag along with <OPTION> tag.
            Buttons can be added to a form using the <BUTTON> tag along
            with the Type attribute.



Assignment

 I. Answer the following questions:
 1. Give any 3 general examples of forms.
 2. Name any 5 controls that can be added to a Form.

 Forms                                                                    2.11-23
Programming and Development Tools                           Web Programming


3. Mention the use of Action and Method attributes of <FORM> tag.
4. Mention the use of any 3 common attributes of Radio Button and Check
   Box controls.
5. Name the types of Buttons and mention their functions.




.




Forms                                                               2.11-24
Programming and Development Tools                             Web Programming




Criterion Referenced Test
Instruction: Students must evaluate themselves to attain the list of
             competencies to be achieved.

Name:
Subject:     Programming and Development Tools
Unit:        Forms

Please tick [ √ ] the appropriate box when you have achieved the respective
competency.

Date                                       Forms
                C1 C2




Comment



Competency codes:

C1 = Draw a form with Text Field, Radio Button, Text Area, Check Box, Drop-
    Down List Box and Button for a candidate to apply for a vacancy in a
    company.
C2 = Create a Web page with Text Field, Radio Button, Text Area, Check
    Box, Drop-Down List Box and Button for a candidate to apply for a
    vacancy in a company.




Forms                                                              2.11-25

Mais conteúdo relacionado

Mais procurados

Practical file on web technology(html)
Practical file on web technology(html)Practical file on web technology(html)
Practical file on web technology(html)RAJWANT KAUR
 
Html viva questions
Html viva questionsHtml viva questions
Html viva questionsVipul Naik
 
SUGUK - News - 2013-12
SUGUK - News - 2013-12SUGUK - News - 2013-12
SUGUK - News - 2013-12Mark Stokes
 
Google ug3509
Google ug3509Google ug3509
Google ug3509hmsoh
 
Web technology practical list
Web technology practical listWeb technology practical list
Web technology practical listdesaipratu10
 
IT- 328 Web Administration (Practicals)
IT- 328 Web Administration (Practicals)IT- 328 Web Administration (Practicals)
IT- 328 Web Administration (Practicals)Dushmanta Nath
 
HTML (Hyper Text Markup Language) Project
HTML (Hyper Text Markup Language) Project HTML (Hyper Text Markup Language) Project
HTML (Hyper Text Markup Language) Project Ankit Gupta
 
Ppr Pts Training Highlights
Ppr Pts Training HighlightsPpr Pts Training Highlights
Ppr Pts Training Highlightsjlschwartz1969
 
Modern SharePoint Content Management Training
Modern SharePoint Content Management TrainingModern SharePoint Content Management Training
Modern SharePoint Content Management TrainingIT Industry
 
Pranavi verma-it 402 class ix-unit 11_presentation
Pranavi verma-it 402 class ix-unit 11_presentationPranavi verma-it 402 class ix-unit 11_presentation
Pranavi verma-it 402 class ix-unit 11_presentationPranaviVerma
 
BIWUG 01/09/2005 IW Technologies, what's to come in 2006?
BIWUG 01/09/2005 IW Technologies, what's to come in 2006?BIWUG 01/09/2005 IW Technologies, what's to come in 2006?
BIWUG 01/09/2005 IW Technologies, what's to come in 2006?BIWUG
 

Mais procurados (19)

Practical file on web technology(html)
Practical file on web technology(html)Practical file on web technology(html)
Practical file on web technology(html)
 
Html viva questions
Html viva questionsHtml viva questions
Html viva questions
 
SUGUK - News - 2013-12
SUGUK - News - 2013-12SUGUK - News - 2013-12
SUGUK - News - 2013-12
 
Web editing
Web editingWeb editing
Web editing
 
Google ug3509
Google ug3509Google ug3509
Google ug3509
 
Web technology practical list
Web technology practical listWeb technology practical list
Web technology practical list
 
IT- 328 Web Administration (Practicals)
IT- 328 Web Administration (Practicals)IT- 328 Web Administration (Practicals)
IT- 328 Web Administration (Practicals)
 
XCode8.0
XCode8.0XCode8.0
XCode8.0
 
HTML (Hyper Text Markup Language) Project
HTML (Hyper Text Markup Language) Project HTML (Hyper Text Markup Language) Project
HTML (Hyper Text Markup Language) Project
 
Ppr Pts Training Highlights
Ppr Pts Training HighlightsPpr Pts Training Highlights
Ppr Pts Training Highlights
 
Modern SharePoint Content Management Training
Modern SharePoint Content Management TrainingModern SharePoint Content Management Training
Modern SharePoint Content Management Training
 
Html
HtmlHtml
Html
 
Html basics
Html basicsHtml basics
Html basics
 
Managing Client E Mail
Managing Client E MailManaging Client E Mail
Managing Client E Mail
 
ms office
ms officems office
ms office
 
902350 html jar
902350 html jar902350 html jar
902350 html jar
 
Pranavi verma-it 402 class ix-unit 11_presentation
Pranavi verma-it 402 class ix-unit 11_presentationPranavi verma-it 402 class ix-unit 11_presentation
Pranavi verma-it 402 class ix-unit 11_presentation
 
WDD
WDDWDD
WDD
 
BIWUG 01/09/2005 IW Technologies, what's to come in 2006?
BIWUG 01/09/2005 IW Technologies, what's to come in 2006?BIWUG 01/09/2005 IW Technologies, what's to come in 2006?
BIWUG 01/09/2005 IW Technologies, what's to come in 2006?
 

Destaque

WordPress: Beyond Blogging
WordPress: Beyond BloggingWordPress: Beyond Blogging
WordPress: Beyond BloggingJoss Winn
 
My Friends Descriptions 5th B
My Friends Descriptions 5th BMy Friends Descriptions 5th B
My Friends Descriptions 5th Benglishdepartment
 
102報稅懶人包
102報稅懶人包102報稅懶人包
102報稅懶人包olivertw
 
0903 Ayethadis
0903 Ayethadis0903 Ayethadis
0903 Ayethadistransportr
 
American Home Sales Prefab Housing - EE in HOME Workshop
American Home Sales Prefab Housing - EE in HOME WorkshopAmerican Home Sales Prefab Housing - EE in HOME Workshop
American Home Sales Prefab Housing - EE in HOME WorkshopICF_HCD
 
A Contribution to the Critique of the Political Economy of Academic Labour
A Contribution to the Critique of the Political Economy of Academic LabourA Contribution to the Critique of the Political Economy of Academic Labour
A Contribution to the Critique of the Political Economy of Academic LabourJoss Winn
 
INFLUENZA H1N1, desde la ciencia, el mito y la realidad
INFLUENZA H1N1, desde la ciencia, el mito y la realidadINFLUENZA H1N1, desde la ciencia, el mito y la realidad
INFLUENZA H1N1, desde la ciencia, el mito y la realidadPablo Gallegos
 
Conferenceware meeting functionalities
Conferenceware meeting functionalitiesConferenceware meeting functionalities
Conferenceware meeting functionalitiesguest01d22d
 
KUŞ GRİBİ
KUŞ GRİBİKUŞ GRİBİ
KUŞ GRİBİanttab
 
Unified in Learning –Separated by Space (S-ICT 2008 Conference Proceedings)
Unified in Learning –Separated by Space (S-ICT 2008 Conference Proceedings)Unified in Learning –Separated by Space (S-ICT 2008 Conference Proceedings)
Unified in Learning –Separated by Space (S-ICT 2008 Conference Proceedings)Martin Rehm
 
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...Martin Rehm
 
2009 Minne Web Con Social Connections In Scientific Research
2009 Minne Web Con Social Connections In Scientific Research2009 Minne Web Con Social Connections In Scientific Research
2009 Minne Web Con Social Connections In Scientific ResearchTimothy Kunau
 
Imd 100503 Herrie In De Keuken
Imd 100503 Herrie In De KeukenImd 100503 Herrie In De Keuken
Imd 100503 Herrie In De Keukenmr38schev
 
Jude's Drafting Table The Strawberry Question
Jude's Drafting Table The Strawberry QuestionJude's Drafting Table The Strawberry Question
Jude's Drafting Table The Strawberry Questionsixteen.wiishes
 

Destaque (20)

WordPress: Beyond Blogging
WordPress: Beyond BloggingWordPress: Beyond Blogging
WordPress: Beyond Blogging
 
My Friends Descriptions 5th B
My Friends Descriptions 5th BMy Friends Descriptions 5th B
My Friends Descriptions 5th B
 
102報稅懶人包
102報稅懶人包102報稅懶人包
102報稅懶人包
 
Fqenlaceionico
FqenlaceionicoFqenlaceionico
Fqenlaceionico
 
0903 Ayethadis
0903 Ayethadis0903 Ayethadis
0903 Ayethadis
 
American Home Sales Prefab Housing - EE in HOME Workshop
American Home Sales Prefab Housing - EE in HOME WorkshopAmerican Home Sales Prefab Housing - EE in HOME Workshop
American Home Sales Prefab Housing - EE in HOME Workshop
 
Anyway
AnywayAnyway
Anyway
 
A Contribution to the Critique of the Political Economy of Academic Labour
A Contribution to the Critique of the Political Economy of Academic LabourA Contribution to the Critique of the Political Economy of Academic Labour
A Contribution to the Critique of the Political Economy of Academic Labour
 
INFLUENZA H1N1, desde la ciencia, el mito y la realidad
INFLUENZA H1N1, desde la ciencia, el mito y la realidadINFLUENZA H1N1, desde la ciencia, el mito y la realidad
INFLUENZA H1N1, desde la ciencia, el mito y la realidad
 
Conferenceware meeting functionalities
Conferenceware meeting functionalitiesConferenceware meeting functionalities
Conferenceware meeting functionalities
 
KUŞ GRİBİ
KUŞ GRİBİKUŞ GRİBİ
KUŞ GRİBİ
 
Unified in Learning –Separated by Space (S-ICT 2008 Conference Proceedings)
Unified in Learning –Separated by Space (S-ICT 2008 Conference Proceedings)Unified in Learning –Separated by Space (S-ICT 2008 Conference Proceedings)
Unified in Learning –Separated by Space (S-ICT 2008 Conference Proceedings)
 
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
 
Unit 1.1
Unit 1.1Unit 1.1
Unit 1.1
 
Funny
FunnyFunny
Funny
 
Iatefl 2013 titova
Iatefl 2013 titovaIatefl 2013 titova
Iatefl 2013 titova
 
2009 Minne Web Con Social Connections In Scientific Research
2009 Minne Web Con Social Connections In Scientific Research2009 Minne Web Con Social Connections In Scientific Research
2009 Minne Web Con Social Connections In Scientific Research
 
ToncrayPRess
ToncrayPRessToncrayPRess
ToncrayPRess
 
Imd 100503 Herrie In De Keuken
Imd 100503 Herrie In De KeukenImd 100503 Herrie In De Keuken
Imd 100503 Herrie In De Keuken
 
Jude's Drafting Table The Strawberry Question
Jude's Drafting Table The Strawberry QuestionJude's Drafting Table The Strawberry Question
Jude's Drafting Table The Strawberry Question
 

Semelhante a Unit 2.11 - Forms

Getting Started with Iron Speed Designer
Getting Started with Iron Speed DesignerGetting Started with Iron Speed Designer
Getting Started with Iron Speed DesignerIron Speed
 
Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017khawagah
 
1.3 Process and Information Layout
1.3 Process and Information Layout1.3 Process and Information Layout
1.3 Process and Information LayoutIntan Jameel
 
Getting the Most out of Data Page and Rich Data Definition in Portlet Factory
Getting the Most out of Data Page and Rich Data Definition in Portlet FactoryGetting the Most out of Data Page and Rich Data Definition in Portlet Factory
Getting the Most out of Data Page and Rich Data Definition in Portlet FactoryDavalen LLC
 
Bringing Zest to SharePoint Sites Using Out-of-the-Box Technology
Bringing Zest to SharePoint Sites Using Out-of-the-Box TechnologyBringing Zest to SharePoint Sites Using Out-of-the-Box Technology
Bringing Zest to SharePoint Sites Using Out-of-the-Box Technologyjoelsef
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan
 
Essential html tweaks for accessible themes
Essential html tweaks for accessible themesEssential html tweaks for accessible themes
Essential html tweaks for accessible themesMartin Stehle
 
Web Concepts for professionals in information technology _Lec5g.pptx
Web Concepts for professionals in information technology _Lec5g.pptxWeb Concepts for professionals in information technology _Lec5g.pptx
Web Concepts for professionals in information technology _Lec5g.pptxclement swarnappa
 
Oracle application express ppt
Oracle application express pptOracle application express ppt
Oracle application express pptAbhinaw Kumar
 
Building Cool apps with flex
Building Cool apps with flexBuilding Cool apps with flex
Building Cool apps with flexJoseph Khan
 
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)topomax
 
14 Easy Steps to End-User Empowerment: Convert Custom Reports to BI Publisher
14 Easy Steps to End-User Empowerment: Convert Custom Reports to BI Publisher14 Easy Steps to End-User Empowerment: Convert Custom Reports to BI Publisher
14 Easy Steps to End-User Empowerment: Convert Custom Reports to BI PublisherMohan Dutt
 
UNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standardUNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standardIntan Jameel
 
Oracle application express
Oracle application expressOracle application express
Oracle application expressAbhinaw Kumar
 
Xhtml Part2
Xhtml Part2Xhtml Part2
Xhtml Part2nleesite
 
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And DxlBp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxldominion
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfoliolarel
 

Semelhante a Unit 2.11 - Forms (20)

M02 un11 p01
M02 un11 p01M02 un11 p01
M02 un11 p01
 
Getting Started with Iron Speed Designer
Getting Started with Iron Speed DesignerGetting Started with Iron Speed Designer
Getting Started with Iron Speed Designer
 
Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017
 
1.3 Process and Information Layout
1.3 Process and Information Layout1.3 Process and Information Layout
1.3 Process and Information Layout
 
Getting the Most out of Data Page and Rich Data Definition in Portlet Factory
Getting the Most out of Data Page and Rich Data Definition in Portlet FactoryGetting the Most out of Data Page and Rich Data Definition in Portlet Factory
Getting the Most out of Data Page and Rich Data Definition in Portlet Factory
 
Bringing Zest to SharePoint Sites Using Out-of-the-Box Technology
Bringing Zest to SharePoint Sites Using Out-of-the-Box TechnologyBringing Zest to SharePoint Sites Using Out-of-the-Box Technology
Bringing Zest to SharePoint Sites Using Out-of-the-Box Technology
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
Unit 2
Unit 2 Unit 2
Unit 2
 
Essential html tweaks for accessible themes
Essential html tweaks for accessible themesEssential html tweaks for accessible themes
Essential html tweaks for accessible themes
 
Web Concepts for professionals in information technology _Lec5g.pptx
Web Concepts for professionals in information technology _Lec5g.pptxWeb Concepts for professionals in information technology _Lec5g.pptx
Web Concepts for professionals in information technology _Lec5g.pptx
 
Oracle application express ppt
Oracle application express pptOracle application express ppt
Oracle application express ppt
 
Building Cool apps with flex
Building Cool apps with flexBuilding Cool apps with flex
Building Cool apps with flex
 
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
 
14 Easy Steps to End-User Empowerment: Convert Custom Reports to BI Publisher
14 Easy Steps to End-User Empowerment: Convert Custom Reports to BI Publisher14 Easy Steps to End-User Empowerment: Convert Custom Reports to BI Publisher
14 Easy Steps to End-User Empowerment: Convert Custom Reports to BI Publisher
 
UNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standardUNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standard
 
Oracle application express
Oracle application expressOracle application express
Oracle application express
 
Xhtml Part2
Xhtml Part2Xhtml Part2
Xhtml Part2
 
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And DxlBp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
Bp308 Ibm Lotus Domino Web Facelift Using Ajax And Dxl
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 

Mais de Intan Jameel (20)

Unit 2.10 - Frames
Unit 2.10 - FramesUnit 2.10 - Frames
Unit 2.10 - Frames
 
M02 un11 p02
M02 un11 p02M02 un11 p02
M02 un11 p02
 
M02 un10 p02
M02 un10 p02M02 un10 p02
M02 un10 p02
 
M02 un10 p01
M02 un10 p01M02 un10 p01
M02 un10 p01
 
M02 un09 p02
M02 un09 p02M02 un09 p02
M02 un09 p02
 
M02 un09 p01
M02 un09 p01M02 un09 p01
M02 un09 p01
 
M02 un08 p01
M02 un08 p01M02 un08 p01
M02 un08 p01
 
M02 un07 p02
M02 un07 p02M02 un07 p02
M02 un07 p02
 
M02 un07 p01
M02 un07 p01M02 un07 p01
M02 un07 p01
 
M02 un06 p02
M02 un06 p02M02 un06 p02
M02 un06 p02
 
M02 un06 p01
M02 un06 p01M02 un06 p01
M02 un06 p01
 
M02 un05 p02
M02 un05 p02M02 un05 p02
M02 un05 p02
 
M02 un05 p01
M02 un05 p01M02 un05 p01
M02 un05 p01
 
M02 un04 p04
M02 un04 p04M02 un04 p04
M02 un04 p04
 
M02 un04 p03
M02 un04 p03M02 un04 p03
M02 un04 p03
 
M02 un04 p02
M02 un04 p02M02 un04 p02
M02 un04 p02
 
M02 un04 p01
M02 un04 p01M02 un04 p01
M02 un04 p01
 
M02 un12 p01
M02 un12 p01M02 un12 p01
M02 un12 p01
 
Unit 2.3 Part 1
Unit 2.3 Part 1Unit 2.3 Part 1
Unit 2.3 Part 1
 
Unit 2.2 Part 1
Unit 2.2 Part 1Unit 2.2 Part 1
Unit 2.2 Part 1
 

Último

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 

Último (20)

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 

Unit 2.11 - Forms

  • 1. Programming and Development Tools Web Programming UNIT 2.11 Web Programming Forms OBJECTIVES This unit helps you to add Forms to your Web page to get the data from the user. At the end of this unit, you will be able to Add a Form to your Web page. Add a Text Field to a Form. Add a Radio Button to a Form. Add a Text Area to a Form. Add a Check Box to a Form. Add a Drop-Down List Box to a Form. Add a Button to a Form. Benchmark standard Design Web pages with Forms to get the data from the user for further processing. Forms 2.11-1
  • 2. Programming and Development Tools Web Programming Let us Revise! 1. Define Frame. 2. Name the different types of Framesets. 3. Write the code segment to create a Web page with horizontal frames.. 4. State the use of <NOFRAMES> tag. 5. Write the code segment to create a Web page with Inline Frame. Introduction You would have filled up a Form in many places. For example, when joining the school you would have given the particulars about yourself such as Name, Age and Date of Birth in a Form. Similarly, the Form in HTML is an element used to get the data from the user. The Form is like a container having elements called controls. The controls used to get data from the user are Text Field, Check box, Radio button, Text area and Drop-down List box. 2.11.1 Designing the Form A Form should be carefully designed keeping in mind certain conditions like the questions to be asked and the controls to be used to get the data from the user. Identifying the questions Before adding a form, you should know the requirement such as the data to be received, the control to be used to receive the data and placement of the controls in the Form element. For example, the data to be received from a student applying for admission in a college are Name, Date of Birth, Address, Grade obtained in his schooling, etc. Hands-On! The following example illustrates the use of forms in a Webpage. Open the HTML file Form.html in Internet Explorer. The code in Form.html file is given below: <HTML> <HEAD> <TITLE> Form </TITLE> </HEAD> <BODY Bgcolor="LightYellow"> Forms 2.11-2
  • 3. Programming and Development Tools Web Programming <FORM> <FONT Size="4"> <H2 Align="Center"> ABC College of Engineering </H2> <H2 Align="Center"> Application Form </H2> 1) Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;:&nbsp;&nbsp; <INPUT Type="Text" Name="Name" Size="60"> <BR><BR> Adds a Text Box 2) Date of Birth &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;:&nbsp;&nbsp; <INPUT Type="Text" Name="DOB"> <BR><BR> Adds a Text Box 3) Sex &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp; <INPUT Type="Radio" Name="Gender">Male &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT Type="Radio" Name="Gender">Female <BR><BR> Adds a Radio Button 4) Nationality &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp; <INPUT Type="Text" Name="Nation" Size="40"> <BR><BR> Adds a Text Box 5) Parent/Guardian Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp; <INPUT Type="Text" Name="Name" Size="60"> <BR><BR> Adds a Text Box 6) Address <BR> Forms 2.11-3
  • 4. Programming and Development Tools Web Programming &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <TextArea Rows="5" Cols="50"></TextArea><BR><BR> 7) Extra Curricular Activities Adds a Text Area &nbsp;&nbsp;&nbsp;:&nbsp;&nbsp; <INPUT Type ="Checkbox" Name="Extra"> Football <INPUT Type ="Checkbox" Name="Extra"> Hockey <INPUT Type ="Checkbox" Name="Extra"> Badminton <INPUT Type ="Checkbox" Name="Extra"> Tennis <INPUT Type ="Checkbox" Name="Extra"> Others <BR><BR> Adds a Check Box 8) Grade obtained &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp ;&nbsp; Mathematics <INPUT Type="Text" Name="Grade1" Size="10"> &nbsp;&nbsp;&nbsp;Physics <INPUT Type="Text" Name="Grade2" Size="10">&nbsp;&nbsp;&nbsp; Chemistry <INPUT Type="Text" Name="Grade3" Size="10"> &nbsp;&nbsp;&nbsp; <BR><BR> 9) Course Applied for &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;:&nbsp;&nbsp; <SELECT> Adds a Drop-Down List Box <OPTION Value="Mech" Name="Mech">Bachelor of Mechanical Engineering <OPTION Value="Civil" Name="Civil">Bachelor of Civil Engineering <OPTION Value="Electrical" Name="Electrical">Bachelor of Electrical Engineering Forms 2.11-4
  • 5. Programming and Development Tools Web Programming <OPTION Value="Electronics" Name="Electronics">Bachelor of Electronics Engineering </SELECT> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp; <BUTTON Type="Submit">Submit</BUTTON> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BUTTON Type="Reset">Reset</BUTTON> Adds a Button </FONT> </FORM> </BODY> </HTML> Code Sample 2.11.1 The Web page shown in Figure 2.11.1 is displayed in the browser window. Text Box Radio Button Text Area Check Box Drop-Down List Box Button Figure 2.11.1: A Web Page Containing a Form Forms 2.11-5
  • 6. Programming and Development Tools Web Programming The Web page shown in Figure 2.11.1 contains an application form displayed in it. When the Submit button is clicked after entering the values in the controls, the entered data are passed to a program that takes care of further processing. In this unit you will be learning to add Forms and controls to your Web page. A Form is added to a Web page using the <FORM> tag. The <FORM> tag has two important attributes. They are Action and Method. The URL of the program file that processes the data entered by the user is assigned to the Action attribute. The Method attribute can have either Get or Post as its value. Get is the default value. If Method = “Get”, the names and values of the data entered are send to the program along with the URL specified in the Action attribute. If Method = “Post”, the names and values of the data entered are send to the program as separate entity. Self-Check Exercise 2.11.1 Say true or false: 1. <FORM> tag is used to add a form to a Web page. 2. Action is the only attribute used with <FORM> tag. 3. The two values of the Method attribute are Get and Post. Activity 2.11.1 1. Draw a form to enter your personal details (Bio-Data). 2.11.2 Working with Form Elements The different controls that can be added to a Form are Text Fields, Radio buttons, Text area, Check box, Drop-down List box and Push buttons. Most of these controls can be added to the form using the <INPUT> tag along with Type attribute. The Text Field The Text Field is a control that is used to get a text from the user and to display a text to the user. It can be added to a form using the <INPUT> tag along with the Type attribute. The following are the codes used to display the Text Fields shown in Figure 2.11.1. <INPUT Type="Text" Name="Name" Size="60"> <BR><BR> <INPUT Type="Text" Name="DOB"> <BR><BR> <INPUT Type="Text" Name="Nation" Size="40"> <INPUT Type="Text" Name="P_Name" Size="60"> Forms 2.11-6
  • 7. Programming and Development Tools Web Programming <INPUT Type="Text" Name="Grade1" Size="10"> <INPUT Type="Text" Name="Grade2" Size="10"> <INPUT Type="Text" Name="Grade3" Size="10"> The attribute Type = “Text” instructs the browser to display a Text Field. The attribute Name = “Name” assigns a name to the Text Field for future use. The attribute Size = “60” specifies the width of the Text Field. The attributes of the <Input> tag related to the Text Field are given in Table 2.11.1. Attribute Value Use Type Text Displays a Text Field Password Displays a Text Field that is used to enter secret information. The text in this field appears as asterisks (*). Name Any Text The value given will be assigned to the Name attribute that can be used for future reference. Size Any Integer value Defines the width of the Text Field. Maxlength Any Integer value Defines the maximum number of characters that can be typed in a Text Field. Readonly --- Can read from the Text Field but you cannot write in the Text Field. Value Any String value The value given in Value attribute will be displayed inside the Textbox by default. Disabled --- Makes the control visible but cannot be used. Table 2.11.1: Attributes of <INPUT> tag related to Text Field The Radio Button The Radio Button is a control that is used to display an option to the user. If the option is applicable to the user, he can select the option by clicking it. Two or more Radio Buttons can be grouped together. The user can select only one option in that group. Radio Button can be added to a form using the <INPUT> tag along with the Type attribute. Forms 2.11-7
  • 8. Programming and Development Tools Web Programming The following are the codes used to display the Radio Buttons shown in Figure 2.11.1. <INPUT Type="Radio" Name="Gender" Value=”M”>Male <INPUT Type="Radio" Name="Gender" Value=”F”>Female The attribute Type = “Radio” instructs the browser to display a Radio Button. The attribute Name = “Gender” assigns a name to the Radio Button for future use. The two Radio Buttons are grouped together by giving the same value for the Name attribute. The value given in Value attribute will be send to the URL specified in the Form’s Action attribute, if the button is selected. The attributes of the <Input> tag related to the Radio Buttons are given in Table 2.11.2. Attribute Value Use Type Radio Displays a Radio Button. Name Any String value The value given will be assigned to the Name attribute that can be used for future reference. Checked --- Indicates that the option remains selected when the form is opened. Disabled --- Makes the control visible but cannot be used. Value Any String value The value given in Value attribute will be send to the URL specified in the Form’s Action attribute, if the button is selected. Table 2.11.2: Attributes of <INPUT> tag related to Radio Buttons The Text Area The Text Area is a control that is used to get a text from the user and to display a text to the user. The difference between a Text Field and a Text Area is that a Text Field can accept or display only one line of text. But, a Text Area can accept or display more than one line of text. It can be added to a form using the <TEXTAREA> tag and Rows and Cols attributes. The following is the code used to display the Text Area shown in Figure 2.11.1. <TextArea Rows="5" Cols="50"></TextArea> The attributes Rows = “5” and Cols=”50” instructs the browser to display a Text Area of 5 rows and 50 columns. The attributes of the <TEXTAREA> tag are given in Table 2.11.3. Forms 2.11-8
  • 9. Programming and Development Tools Web Programming Attribute Value Use Rows Any Integer value Specifies the number of rows visible in the Text Area Cols Any Integer value Specifies the number of columns visible in the Text Area Name Any String value The value given will be assigned to the Name attribute that can be used for future reference. Readonly --- Can read from the Text Area but you cannot write in the Text Area. Disabled --- Makes the control visible but cannot be used to modify the text. Table 2.11.3: Attributes of <TEXTAREA> tag Lab Exercise Lab Exercise 1: Open D11_1.html in Internet Explorer. The following code will be present in D11_1.html. <HTML> <HEAD> <TITLE> STUDENT INFORAMTIONS </TITLE> </HEAD> <BODY> <H1 Align =CENTER> STUDENT INFORMATIONS </H1> <BR> <FORM> NAME: <INPUT Type ="TEXT" NAME="TXT_NAME" Size=5 Maxlength=5 ><BR><BR> PASSWORD: <INPUT Type ="PASSWORD" Name = "TXT_NAME" Size = 5 Maxlength=5><BR><BR> ADDRESS: <TEXTAREA Name = "TXT_ADDRESS" Rows=4 Cols=30></TEXTAREA><BR><BR> PHONE : <INPUT Type = "TEXT" Name="TXT_PHONE" Forms 2.11-9
  • 10. Programming and Development Tools Web Programming Size=8><BR><BR> </FORM> </BODY> </HTML> 1. Name attributes which are used in input tag. 2. Identify the attribute which is used to specify the input type. 3. Identify the attribute which is used to set the length of the text box. 4. Observe the difference between size and maxlength. 5. Identify the tag which is allows to enter the multiline text entry. 6. Name the attribute which are used in textarea. Lab Exercise 2: Open D11_1.html in Internet Explorer. 1. View the source code in the Notepad. 2. Increase the size of the Name textbox to 10. 3. Insert value into Name textbox and observe the difference. 4. Change the Password textbox type to password. 5. Increase the no of columns of the textarea to 40. 6. Decrease the no of row of the textarea to 3. Self-Check Exercise 2.11.2 Name the tag and attribute to be used for the following: 1. To add a Text Field whose width is 9 characters and maximum number of characters that can be entered is 25. 2. To add 2 Radio Buttons of same group displaying Yes and No. The values of the 2 Radio Buttons should be “Y” and “N”. 3. To add a Text Area of 6 rows and 50 columns. The Check Box The Check Box is a control that is used to display an option to the user. If the option is applicable to the user, he can select the option by clicking it. Two or more Check Boxes can be grouped together. The user can select any number of Check Boxes in that group. Check Box can be added to a form using the <INPUT> tag along with the Type attribute. The following are the codes used to display the Radio Buttons shown in Figure 2.11.1. <INPUT Type ="Checkbox" Name="Extra"> Football <INPUT Type ="Checkbox" Name="Extra"> Hockey <INPUT Type ="Checkbox" Name="Extra"> Badminton <INPUT Type ="Checkbox" Name="Extra"> Tennis <INPUT Type ="Checkbox" Name="Extra"> Others The attribute Type = “Checkbox” instructs the browser to display a Check Box. The attribute Name = “Extra” assigns a name to the Check Box for future use. Forms 2.11-10
  • 11. Programming and Development Tools Web Programming The five Check Boxes are grouped together by giving the same value for the Name attribute. The attributes of the <Input> tag related to the Check Boxes are given in Table 2.11.4. Attribute Value Use Type Checkbox Displays a Check Box. Name Any String value The value given will be assigned to the Name attribute that can be used for future reference.. Checked --- Indicates that the option remains selected when the form is opened. Disabled --- Makes the control visible but cannot be used. Value Any Text The value given in Value attribute will be send to the URL specified in the Form’s Action attribute, if the button is selected. Table 2.11.4: Attributes of <INPUT> tag related to Check Boxes Note The difference between a Radio Button and a Check Box is that only one option can be selected in a group of Radio Buttons whereas more than one option can be selected in a group of Check Boxes. The Drop-Down List Box The Drop-Down List Box is a control that is used to display a list of items in a rectangular box from which the user can select an option. If the option is applicable to the user, he can select the option by clicking it. Drop-Down List Box can be added to a form using the <SELECT> tag along with <OPTION> tag. The following are the codes used to display the Drop-Down List Box shown in Figure 2.11.1. <SELECT> <OPTION Value="Mech" Name="Mech">Bachelor of Mechanical Engineering <OPTION Value="Civil" Name="Civil">Bachelor of Civil Engineering <OPTION Value="Electrical" Name="Electrical">Bachelor of Electrical Engineering Forms 2.11-11
  • 12. Programming and Development Tools Web Programming <OPTION Value="Electronics" Name="Electronics">Bachelor of Electronics Engineering </SELECT> The <SELECT> tag instructs the browser to display a Drop-Down List Box. The <OPTION> tag is used to display the items inside the Drop-Down List Box. In the above example, the four items are grouped together in a Drop- Down List Box by giving the same value for the Name attribute of the <OPTION> tag. The item to be displayed in the Drop-Down List Box is assigned to the Value attribute of the <OPTION> tag. The attributes of the <SELECT> tag are given in Table 2.11.5. Attribute Value Use Name Any String value The value given will be assigned to the Name attribute that can be used for future reference. Size Any Integer value Specifies the number of items visible in the Drop- Down List Box. Disabled --- Makes the control visible but cannot be used. Multiple --- Specifies that more than one item can be selected. Table 2.11.5: Attributes of <SELECT> tag The attributes of the <OPTION> tag are given in Table 2.11.6. Attribute Value Use Selected --- Specifies that this option appears as the selected option by default Value Any Text The value given in Value attribute will be send to the URL specified in the Form’s Action attribute, if the option is selected. Disabled --- Makes the option visible but cannot be selected Table 2.11.6: Attributes of <OPTION> tag The Button The Button is a control that is used to display a push button. The function of the Push Button varies depending upon the type of the button. The button can Forms 2.11-12
  • 13. Programming and Development Tools Web Programming be of 3 types. They are Submit button, Reset button and a Push button. The Submit button sends the values entered by the user to the URL specified in the Form’s Action attribute. The Reset button sets the values of all the controls to their initial values. For the normal buttons, commands should be given for the action to be taken if it is clicked. Buttons can be added to a form using the <BUTTON> tag along with the Type attribute. The following are the codes used to display the buttons shown in Figure 2.11.1. <BUTTON Type="Submit">Submit</BUTTON> <BUTTON Type="Reset">Reset</BUTTON> The attribute Type = “Submit” instructs the browser to send the values entered by the user to the URL specified in the Form’s Action attribute. The attribute Type = “Reset” instructs the browser to set the values of all the controls to their initial values. The attributes of the <BUTTON> tag are given in Table 2.11.7. Attribute Value Use Type Submit Instructs the browser to send the values entered by the user to the URL specified in the Form’s Action attribute. Reset Instructs the browser to set the values of all the controls to their initial values. Button Instructs the browser to execute the commands given for the action to be taken if it is clicked. Name Any Text The value given will be assigned to the Name attribute that can be used for future reference. Disabled --- Makes the control visible but cannot be used. Value Any Text Specifies the initial value to the button. Table 2.11.7: Attributes of <BUTTON> tag Lab Exercise Lab Exercise 3: Open D11_2.html in Internet Explorer. The following code will be present in D11_2.html. Forms 2.11-13
  • 14. Programming and Development Tools Web Programming <HTML> <HEAD> <TITLE> HOBBIES </TITLE> </HEAD> <BODY> <H3> CHOOSE YOUR HOBBIES </H3> <FORM> <INPUT Type ="CHECKBOX" Name = "CHK_HOBBY" Value="SONGS" > Hearing Songs <INPUT Type ="CHECKBOX" Name = "CHK_HOBBY" Value="GAMES" >Playing Games <INPUT Type ="CHECKBOX" Name = "CHK_HOBBY" Value="BOOKS" > Reading Books <INPUT Type ="CHECKBOX" Name = "CHK_HOBBY" Value="TRAVELLING"> Travelling <BR> <BR> <BR> <H3> CHOOSE YOUR PET </H3> <INPUT Type="RADIO" Name="PET" Value ="DOG" Checked> Dog <INPUT Type="RADIO” Name="PET" Value ="CAT" Checked> Cat <INPUT Type="RADIO" Name="PET" Value ="DOVE" Checked> Dove <BR><BR> <H3> CHOOSE YOUR FAVOURATE GAME </H3> <SELECT Name ="FOOD" Size=3> <OPTION > FOOTBALL <OPTION> HOCKEY <OPTION> TABLE TENNIS <OPTION> TENNIS <OPTION> SWIMMING </SELECT> <BR><BR> <INPUT Type="SUBMIT" Value ="SUBMIT"> <INPUT Type="RESET" Value ="RESET"><BR> </FORM> </BODY> </HTML> 1. Locate the input type which is used to choose more than one option. 2. Name the input type which is used to choose single option. 3. Identify the tag which is used to display the drop-down menu options. 4. Name attributes which are used in <SELECT>. Forms 2.11-14
  • 15. Programming and Development Tools Web Programming Lab Exercise 4: Write a HTML code to display the output as given in the following Figure 2.11.2 using <FORM> tag. Figure 2.11.2: Student Mark Sheet Form Forms 2.11-15
  • 16. Programming and Development Tools Web Programming Lab Exercise 5: Write a HTML code to display the output as given in the following Figure 2.11.3 using <FORM> tag. Figure 2.11.3: Student Informations Form Forms 2.11-16
  • 17. Programming and Development Tools Web Programming Lab Exercise 6: Write a HTML code to display the output as given in the following Figure 2.11.4 using <FORM> tag. Figure 2.11.4: Master Card Application From Forms 2.11-17
  • 18. Programming and Development Tools Web Programming Lab Exercise 7: Write a HTML code to display the output as given in the following Figure 2.11.5 using <FORM> tag. Figure 2.11.5: Online Booking Forms 2.11-18
  • 19. Programming and Development Tools Web Programming Lab Exercise 8: Write a HTML code to display the output as given in the following Figure 2.11.6 using <FORM> and <TABLE> tag. Figure 2.11.6: Employment Application Form Forms 2.11-19
  • 20. Programming and Development Tools Web Programming Lab Exercise 9: Write a HTML code to display the output as given in the following Figure 2.11.7 using <FORM> and <FRAME> tag. Figure 2.11.7: School Application Form Self-Check Exercise 2.11.3 Rewrite the following sentences correctly, if they are wrong: 1. The Checked attribute of the <INPUT> tag indicates that the checkbox option remains selected when the form is opened. 2. The Multiple attribute of the <SELECT> tag specifies that more than one item can be selected in a Drop-Down List Box. 3. Buttons can be added to a form using the <BUTTON> tag along with the Type attribute. Activity 2.11.2 1. Create a Web page that displays a form to enter user’s personal details (Bio-Data). 2. Save the HTML file as Activity1.html. Forms 2.11-20
  • 21. Programming and Development Tools Web Programming Activity 2.11.3 1. Create a Web page that explains the Form as shown in Figure 2.11.8. 2. Save the HTML file as Activity2.html. 3. The hyperlink Adding Controls at the bottom of the page should be linked to Add_Controls.html. Figure 2.11.8: A Web page Explaining the Form Activity 2.11.4 1. Create a Web page that explains the controls as shown in Figure 2.11.3. 2. Save the HTML file as Add_Controls.html. 3. The content of the same page is continued in Figure 2.11.9. Forms 2.11-21
  • 22. Programming and Development Tools Web Programming Figure 2.11.9: A Web page Explaining the Controls Figure 2.11.10: Continuation of Web page shown in Figure 2.11.9 Forms 2.11-22
  • 23. Programming and Development Tools Web Programming Technical Terminologies Form - A Form in HTML is an element used to get the data from the user. Text Field - The Text Field is a control that is used to get a text from the user and to display a text to the user. Radio Button - The Radio Button is a control that is used to display an option to the user. Text Area - The Text Area is a control that is used to get a text from the user and to display a text to the user. Check Box - The Check Box is a control that is used to display an option to the user. Drop-Down List Box - The Drop-Down List Box is a control that is used to display a list of items in a rectangular box from which the user can select an option. Button - The Button is a control that is used to display a push button. Summary In this unit, you learnt that The Form is like a container containing elements called controls. Text Field, Check box, Radio button, Text area and Drop-down List box are some of the controls used to get data from the user. The <FORM> tag has two important attributes namely, Action and Method. Text Field, Radio Button and Check Box can be added to a form using the <INPUT> tag along with the Type attribute. Text Area can be added to a form using the <TEXTAREA> tag and Rows and Cols attributes. Drop-Down List Box can be added to a form using the <SELECT> tag along with <OPTION> tag. Buttons can be added to a form using the <BUTTON> tag along with the Type attribute. Assignment I. Answer the following questions: 1. Give any 3 general examples of forms. 2. Name any 5 controls that can be added to a Form. Forms 2.11-23
  • 24. Programming and Development Tools Web Programming 3. Mention the use of Action and Method attributes of <FORM> tag. 4. Mention the use of any 3 common attributes of Radio Button and Check Box controls. 5. Name the types of Buttons and mention their functions. . Forms 2.11-24
  • 25. Programming and Development Tools Web Programming Criterion Referenced Test Instruction: Students must evaluate themselves to attain the list of competencies to be achieved. Name: Subject: Programming and Development Tools Unit: Forms Please tick [ √ ] the appropriate box when you have achieved the respective competency. Date Forms C1 C2 Comment Competency codes: C1 = Draw a form with Text Field, Radio Button, Text Area, Check Box, Drop- Down List Box and Button for a candidate to apply for a vacancy in a company. C2 = Create a Web page with Text Field, Radio Button, Text Area, Check Box, Drop-Down List Box and Button for a candidate to apply for a vacancy in a company. Forms 2.11-25