Suspecting submit form error

A

Andy Kasotia

I have an ASP UI with VB Dll as a COM object that access the DB2
Database.

I have a "Calculate" button on the ASP Page which when clicked does form
validation (javascript) and submits the form (Javascript) to the same
ASP page. When the ASP page receives the form information it stores all
the form information in VB properties and then eventually saves it to
the Database. After that it retrieves the values back from the VB
properties so as to pass it down to the client to load the same ASP Page
again with the values that were selected as well as creates a PDF
document in a new window (Lets call it Window XYZ).
So far everything is working fine. If I let that window XYZ with the PDF
document stay open and hit the CALCULATE button again, it generates a
new PDF in the XYZ window but does not have any information from the
page that I hit the CALCULATE button from. When I look in the database,
the information from the page where i hit the calculate button has been
wiped out thus explaining why it didn't show up on the new PDF. Also the
ASP page has lost its information thus while doing the save in the
database it wiped out the previous values in the database thus
explaining why the Database doesn't have it. But if i close the XYZ
window and then hit the Calculate button then the PDF document comes up
with the right information. So every time I want to hit the Calculate
button I have to close the XYZ window from the previous time in order to
make sure that my information doesn't get deleted. I forgot to mention
earlier that the new window XYZ opens up due to the target being set to
NEW while doing the submit form.

Sample ASP page Code:
Javascript: (The javascript is actually in an external file which is
included in the page. I have just copied and pasted the code that really
matters in this page.
<HTML>
<HEAD>
function ValidateForm()
{ //Does some data validation and then submits

eval(document.frmPlcyPropInfo.target = '_new') ;
eval(document.frmPlcyPropInfo.action = 'PlcyPropInfo.asp?Action=5') ;
eval( "document." + FormName + ".submit()" ) ;
}

Dim CltProg
ActionVal = Request.QueryString( "Action" )
If ActionVal = 5 then '---5 meaning you hit the calculate button
PlcyPropInfo.Program = request.form("txtProgram") --stores the form
data into VB property
PlcyPropInfo.SaveData() -- does the actual save to the Database
PrintPDF --- prints the PDF in the new XYZ Window
End If

CltProg = PlcyPropInfo.Program -- retrieves the value from VB and
stores in this variable which is used in the HTML to re-populate the
field which was selected by the user

</HEAD>
<BODY Language="Javascript">
<FORM name=frmPlcyPropInfo Method="POST">

<span class="DoPos" id=spnInside style="LEFT: 7%; TOP:
37%">Inside</span>
<input id="txtProgram" name="txtProgram" class="Mask" style="LEFT: 17%;
TOP: 37%; WIDTH:15%" MASK="currency" tabindex=5 maxlength=12
value=<%=CltProg%>>

<INPUT CLASS="DoPos" id="cmdCalculate" name="cmdCalculate" type="button"
value="Calculate" style="LEFT:80%;TOP:10%;WIDTH:15%;HEIGHT:6%"
LANGUAGE=javascript onclick="return ValidateForm()">

Can somebody point out to where I could be having a problem?
I apologize for the lengthy post but thought would help if I expalined
the problem in detail.
 
A

Andy Kasotia

Correction to my Javascript function. It should be without the eval
function.
document.frmPlcyPropInfo.target = '_new';
document.frmPlcyPropInfo.action = 'PlcyPropInfo.asp?Action=5');
document.frmPlcyPropInfo.submit());
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top