ServersCreating Dynamic Forms Page 3

Creating Dynamic Forms Page 3




‘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“>


Latest Posts

Related Stories