ServersCreating Dynamic Forms Page 5

Creating Dynamic Forms Page 5




This page verifies the transaction doesnt already exist, then
inserts it into the tran table. Then we create a form with the
number of components the transaction needs and passes it on to the
3rd form.


SESSION(“INDEX”) =
REQUEST.FORM(“INDEX”)
SESSION(“TYPE”) =
REQUEST.FORM(“TYPE”)
‘we set some
session varaibles so we have them available for the next
page

MY_type =
CInt(SESSION(“type”))
session(“FT”) = request.form(“ft”)
FT =
CInt(SESSION(“FT”))
session(“sub”) =
request.form(“sub”)
MY_SUB =
CInt(SESSION(“SUB”))
Session(“RPT”) = Request.Form(“RPT”)
RPT
= SESSION(“RPT”)
SESSION(“NAME”) =
REQUEST.FORM(“NAME”)

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”)
‘first see if the tran already exists
SQL = “SELECT * FROM TRAN WHERE TR_NAME = ‘” &
REQUEST.FORM(“NAME”) & “‘”
countrs.Open sql, count, 3 , 3, 1

IF COUNTRS.RECORDCOUNT > 0 THEN
   
RESPONSE.WRITE “TRAN ALREADY EXISTS, USE THE EDIT
TRANSACTION”
    RESPONSE.END 
‘response.end ends the transaction
END IF
‘insert the
transaction into the tran set

SQL =
“INSERT INTO TRAN (TR_NAME, TR_GROUP, TR_SUB_GROUP,” & _

TR_CODE, TR_FILE_TYPE” & _
“) VALUES (‘” &
REQUEST.FORM(“NAME”) & “‘, ” & MY_TYPE & “, ” &
my_SUB & _
“, ‘” & RPT & “‘, ” & FT & “)”

countrs.close
countrs.Open sql, count, 3 , 3, 1 
‘ do a select to find the unique id
assigned

SQL = “SELECT * FROM TRAN
WHERE TR_CODE = ‘” & RPT & “‘”
countrs.Open sql, count, 3
, 3, 1
SESSION(“NEW_TRAN_ID”) = COUNTRS.FIELDS(“TR_ID”)
‘set the session var
COUNTRS.CLOSE

%>

Add<br /> of the <font color="#ff0000"></font><br /> transaction

i =
CInt(SESSION(“INDEX”))
‘here we have
to create 3(x) number of input boxes, where x is the number
of
‘indexes from the last posting form
. Each index will have 3
input boxes, the first for the name of the ‘component, the second
for the position and the last for the maximum length.

j = 1
do while j

COMPONENT :

NAME:<input type="text" name="N
size=”20″>
   POSITIONname=”P
size=”7″>      
LENGTH<input type="text" name="L“size=”7”>

j = j + 1
loop
%>

type=”reset” value=”Reset”
name=”B2″>


Latest Posts

Related Stories