SHARE
Facebook X Pinterest WhatsApp

Creating Dynamic Forms Page 3

Jul 20, 2010
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



‘This page generates a form page from the
database set components.
‘Each component has contains a
description position and max length

SESSION(“TRAN”) =
REQUEST(“TRAN_ID”)

THIS_TRAN = SESSION(“TRAN”)
Set count =
Server.CreateObject(“ADODB.Connection”)
DB_PATH =
SERVER.MAPPATH(“/TDOM/DB”)
CONNECT_STR =
“FILEDSN=”&DB_PATH&”DB.DSN;” & _
“DBQ=” &
DB_PATH & “WEBDB.MDB;”
count.Open CONNECT_STR
set countrs
= Server.CreateObject(“ADODB.RecordSet”)
SQL = “SELECT TR_NAME,
TR_FILE_TYPE FROM TRAN WHERE ” & _
                           
“TR_ID=”&THIS_TRAN

countrs.Open sql, count, 3 , 3,
1
IF COUNTRS.EOF THEN   ‘cant find any transactions
     RESPONSE.WRITE (“NO
TRANSACTION EXISTS!”)
    
RESPONSE.END   
‘response.end stops the asp here
ELSE
‘save off the 2
needed fields from the DB

TRAN_NAME =
countrs.Fields(“TR_NAME”)
TRAN_FT =
COUNTRS.FIELDS(“TR_FILE_TYPE”)
COUNTRS.CLOSE

%>

<font color="#ff0000"></font>

Set count =
Server.CreateObject(“ADODB.Connection”)
DB_PATH =
SERVER.MAPPATH(“/TDOM/DB”)
CONNECT_STR =
“FILEDSN=”&DB_PATH&”DB.DSN;” & _
“DBQ=” &
DB_PATH & “WEBDB.MDB;”
count.Open CONNECT_STR

‘create a drop down of the possible insurance
types

set countrs =
Server.CreateObject(“ADODB.RecordSet”)
SQL = “SELECT * FROM
GROUPS”
countrs.Open sql, count, 3 , 3, 1
FIRST_TIME = 1

IF NOT COUNTRS.EOF THEN
%>

INSURANCE TYPE

IF FIRST_TIME = 1
THEN
       RESPONSE.WRITE ”
SELECTED ”  
‘make the first
type the default

       FIRST_TIME =
0
END IF %>

VALUE = ““>%>
COUNTRS.MOVENEXT
LOOP  
‘loop thru all the groups
COUNTRS.CLOSE %>




SQL = “SELECT * FROM COMPONENTS WHERE
TR_TRAN_ID = “& THIS_TRAN & ” ORDER BY
TR_POSITION”
countrs.Open sql, count, 3 , 3,
1
%>

‘ create a table 2 columns wide of all
the components

TABLE = 0
DO WHILE
NOT COUNTRS.EOF
%>

TABLE = 1 %>

ELSE
TABLE = 0
END IF
%>

COUNTRS.MOVENEXT
IF TABLE = 0
THEN %>

END
IF

LOOP

END
IF
%>


RESPONSE.WRITE COUNTRS.FIELDS(“TR_NAME”) & “:

%>

<input type="text" name="FIELD
size=”
‘create
box 5 larger than the max

TEMP = TEMP
+ 5
RESPONSE.WRITE TEMP %>
” MAXLENGTH =  
‘create a max length“>

Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
What Is a Network Policy Server (NPS)? | Essential Guide
Virtual Servers vs. Physical Servers: Comparison and Use Cases
Ray Fernandez
Nov 14, 2023
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.