ASP Data Collection Forms- Form Attributes
Author's Site: Webade
Reference ID: 15623
Setting the Attributes in the Properties Inspector
At this point we will look at the Property Inspector, also called the
If we click on the form field we have just inserted the property inspector
will look like the image below.
We have a couple of things to do in the PI, first we will give the text
field a meaningful name. If we don't do this it will become extremely
difficult to manage the response page, this will become apparent when
we begin working on the response page.
I have named the text field: firstname
The Char Width I have set to: 12
This restricts the width of the the text field though other factors do
come into play such as fontsize, the larger the font the more space 12
characters will need, likewise the height of the text field is effected
in the same manner. Their was no real need to restrict the width in this
example, but if your form is to go into a side bar or similar it can be
necessary to do this to keep the design of your page as you would wish.
Max Chars: 30
This value sets a limit on the amount of characters that can be inserted
into the text field. I'm going to set this to thirty which should be more
than enough for a First Name.
Single line: Selected
Again a single line text field should be ample for a first name.
Init Val: Blank
The initial value for the text field I have left blank, this means the
text field will be empty when viewed. Should I wish to prompt a user or
supply information I would set the initial value in the box provided,
whatever you type into this box will be shown in the text field when the
How the PI Should Look Now
Your Property Iinspector should now look like the image above. It does,
great! Lets move on to the form itself.
Setting the Form
It's good practice to name everything, especially if the page is a busy
page containing more than one form. By default when we insert our form
it is given a name of form1, should we insert a second form it is called
form2 and so on. It quickly becomes easy to see the advantages of naming
our page elements. We'll start off with good habits and give our form
a "proper name".
Click inside your form, anywhere will do. On the bottom left hand side
of the status bar you will see a series of tags depending on where inside
the form you clicked. Select the <form> tag by clicking it as below,
your PI will now be showing the forms attributes as in the right hand
First we will give the form a name, I've called mine: info
Now we need to tell the form what to do when the user clicks the submit
button, we do this by setting the forms Action box.
Setting the form's action:
To make sure we set the action correctly we will click on the folder icon
and then browse to the receiving page, this elimnates the possibility
of spelling errors or the like which will prevent our form from doing
its job. In our case we want to set the action to the form_response.asp
Your PI should now look like the image below with the <form> tag
selected on the status bar.
The method drop list provides alternate methods of passing the data from
the form page to the response page, we will use the post method. The post
method works (briefly) like this, the URL of the response page is sent
to the server and when the server sees the "post" declaration
it waits for the information that the post declaration says will follow.
This is the preferred transfer method stated by the W3C.
With the alternate method of "get" the browser transfers the
information as part of the URL.