Home  |  Latest News  |  Contribute  |  F.A.Q.  |  Account  |  Scripts | About
Search ASPNut:
 
ASP Reference
Server Variables
ASP Glossary
Related Sites

Free Components

HTML Reference
Web Colors
Entities
CSS Level 1
Encode/Decode
Glossary

Our Sponsors
ASP Nuke CMS
Free Auctions
PHP 5 Script
Funktastic Blog
ULost Directory
Team Task

 

 

 

 

 

 

 

 

 

 

 

 

Web Form FAQ

Contains common questions for people who work with web forms.

How do I create a WYSIWYG text input that displays HTML?

You can do this by creating an instance of the rich text-edit control. This is a fairly advanced topic and to describe it here would take up well over 2 pages of detail.

How do I pass text data in the querystring portion of the URL?

When you pass data using the querystring portion of the URL, you will need to make use of the URLEncode function to properly encode the text. This will make sure that special characters such as " " space and "&" ampersand are encoded properly.

<a href="/page.asp?name=<%= Server.URLEncode(sName) %>">My Page</A>

How do I encode data for the value attribute or TEXTAREA inputs?

Use the Server.HTMLEncode to properly encode any special characters that may cause problems with input controls. This will escape special characters such as quote (") and the left angle bracket (<).

<input type="text" value="<%= Server.HTMLEncode("say ""hi""") %>">

How do I populate a select input from an array?

<%
Dim aDay = Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
%>

<select name="day">
<% For I = 0 To UBound(aDay) %>
<option value="<%= aDay(I) %>"> <%= aDay(I) %>
<% Next %>
</select>

How do I create a group of radio buttons?

In order to create a group of radio buttons, you simply assign them the same NAME attribute. This attribute defines the name/value pair that is assigned to the Request.Form collection after the form is submitted.

<input type="radio" name="sex" value="1"> Male
<input type="radio" name="sex" value="2"> Female
<input type="radio" name="sex" value="3"> Yes, Please!

How do I create a list control?

A list control is created by making a SELECT input and giving it a SIZE attribute greater than 1. This will display more than one option in the list at a time. Instead of appearing as a drop-list, the client will see a scrollable list of options to choose from.

<select size="3" name="Color">
<option> green
<option> red
<option> blue
</select>

How to test if a form has posted to itself without using Request.Form?

Use the ServerVariables collection to test the REQUEST_METHOD property. If it is "POST", then some page has submitted to it, otherwise it will be "GET".

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then ...

How do I pass data in a form without using an input control?

You can do this by inserting data into the querystring portion of the URL to post to, by creating hidden input controls, using the ASP session object or by using HTTP cookies.

To create a hidden input control in your form, use the following HTML:

<input type="hidden" name="firstname" value="bob">

Orvado Technologies

ASP Nuke CMS
Free Open Source
Content Manager
HomeFix Boards
Home Remodeling
Message Boards

Contact Us | Contribute | About | Site Map



"I do not think much of a man who is not wiser today than he was yesterday." - Abraham Lincoln

©2010 San Diego Web Design - Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.