computergeek
Programmer
Hello,
I am trying to track whether the user is adding or just updating the record. On the page I have several recordsets (some for just populating dropdown lists), formmanager dtc, and a number of textbox dtc's. OnClick of the add button I set a variable add_tank_trans=true, then when the user clicks the Save button I check this variable, if true I execute an insert, else I update. The add_tank_trans variable does get set to "TRUE", but seems to get set to empty when the user clicks the save button?! So when the Save function checks it value it is neither true or false... therefore the processing fails. Why is this variable being set to empty?
<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
Dim add_tank_trans
Sub Btadd_onclick()
' Set flag for additon of new Tank record to true
add_tank_trans = true
' Move to the end of the recordset and clear fields
rsTankbyID.moveLast
rsTankbyID.addRecord
End Sub
Sub btsave_onclick()
if add_tank_trans = true then
Response.Write "add_tank_trans = True"
' Insert record
else
rsTankbyID.updateRecord()
' Check for errors etc.
end if
' more code here...
' variable is set to false at the end of the script
add_tank_trans = false
End Sub
I'm stuck...please help. Thanks.
Computergeek
I am trying to track whether the user is adding or just updating the record. On the page I have several recordsets (some for just populating dropdown lists), formmanager dtc, and a number of textbox dtc's. OnClick of the add button I set a variable add_tank_trans=true, then when the user clicks the Save button I check this variable, if true I execute an insert, else I update. The add_tank_trans variable does get set to "TRUE", but seems to get set to empty when the user clicks the save button?! So when the Save function checks it value it is neither true or false... therefore the processing fails. Why is this variable being set to empty?
<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
Dim add_tank_trans
Sub Btadd_onclick()
' Set flag for additon of new Tank record to true
add_tank_trans = true
' Move to the end of the recordset and clear fields
rsTankbyID.moveLast
rsTankbyID.addRecord
End Sub
Sub btsave_onclick()
if add_tank_trans = true then
Response.Write "add_tank_trans = True"
' Insert record
else
rsTankbyID.updateRecord()
' Check for errors etc.
end if
' more code here...
' variable is set to false at the end of the script
add_tank_trans = false
End Sub
I'm stuck...please help. Thanks.
Computergeek