Forms In ASP

Tips >> ASP

In these articles we will explain you the details of forms in ASP. The aim of this tutorial is to familiarize you with the ASP data collection form. We will create two pages; the form page for the viewer to add the data for submission, and the response page that will gather the data and send it on to its pre-designated destination. Further to this we will look at how we can arrange the collected data into a legible format by breaking down the information into sections so our clients can receive a structured response to the requested information. The process will involve some simple hand coding (VBScript), but nothing that you can't cope with! The Request.QueryString and Request.Form commands may be used to retrieve information from forms, like user input.

The Below the the explanation of Structuring The Form :-

Structuring the Form With our form on the page we can now begin to design the forms content ensuring that your cursor is inside the form, insert a one row two column table. I prefer to set cellpadding to 5 to give the form elements some "air", the width of the table will be governed by your design; for the purpose of this tutorial I'll use a width of 85% with the cellspacing and Border attributes set to zero.

The below is the explanation of Adding The Form Elements :-

During Adding the Form Elements We will begin by adding the text fields title.

  • User Input
    The Request object may be used to recover user information from forms.

    The below stated is the Form Example :-

    <form method="get" action="simpleform.asp">
    First Name: <input type="text" name="fname" />
    <br />
    Last Name: <input type="text" name="lname" />
    <br /><br />
    <input type="submit" value="Submit" />
    </form>

    User input can be retrieved in two ways :- With Request.QueryString or Request.Form.

Lets explain you one user Input :-

  • Request Form

    The Request.Form command is used to collect values in a form with method="post". Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

    If a user typed "Vipul" and "Parekh" in the form example above, the URL sent to the server would look like this :-


    https://www.Virtualsplat.com/simpleform.asp

    Assume that the ASP file "simpleform.asp" contains the following script :-

    <body>
    Welcome
    <%
    response.write(request.form("fname"))
    response.write(" " & request.form("lname"))
    %>
    </body>


    The browser will display the following in the body of the document :-

    Welcome Vipul Parekh
  • Form Validation

    User input should be validated on the browser whenever possible (by client scripts). Browser validation is faster and you reduce the server load.

    You should consider using server validation if the user input will be inserted into a database. A good way to validate a form on the server is to post the form to itself, instead of jumping to a different page. The user will then get the error messages on the same page as the form. This makes it easier to discover the error.

 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641