...

View Full Version : results form cannot display



krikri
12-19-2003, 02:41 AM
Hi,
I have a form which accepts input alright but cannot display the results on another page. The form is at

krikri dot 0 catch dot com

Here is the code :
----------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Factoring Calculator</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<SCRIPT language=javascript>
<!--
function lst_onChange(lst) {
var v = lst.options[lst.selectedIndex].value;
if ((v.length > 1) && (v != "null")) {
window.location.href = v;
}
}

function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v3.0
var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);
if (app.indexOf('Netscape') != -1) {
if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
} else if (app.indexOf('Microsoft') != -1) {
if (version >= IEvers || verStr.indexOf(IEvers) != -1)
{if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}
else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
} else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }
}

function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_validateForm() { //v3.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (val!=''+num) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}

function commas(pre) {
pre = pre.toString();
if (pre.substring(0, 1)=="-") {
sign = "-";
pre = pre.substring(1, pre.length);
}
else
sign = "";
i = pre.length
while (i > 3) {
pre = pre.substring(0, i-3) + "," + pre.substring(i-3, pre.length);
i = i - 3;
}
pre = sign + pre;
return pre;
}
function txt1a_onChange() {
document.frmEval.txt1b.value = document.frmEval.txt1a.value*12;
}
function txt3a_onChange() {
document.frmEval.txt3b.value = Math.round((document.frmEval.txt1b.value-document.frmEval.txt3a.value)/document.frmEval.txt1b.value*100);
}
function lst5_onChange() {
if (document.frmEval.lst5.options[document.frmEval.lst5.selectedIndex].value=="No")
document.frmEval.txt6.value = "0";
else
document.frmEval.txt6.value = "";
}
function lst9a_onChange() {
document.frmEval.txt9b.value = document.frmEval.txt1b.value*document.frmEval.lst9a.options[document.frmEval.lst9a.selectedIndex].value/100;
}
function btnCalculate_onClick(primerate) {
with (document.frmEval) {
txt1b.value = txt1a.value*12;
txt3b.value = Math.round((txt1b.value-txt3a.value)/txt1b.value*100);
txt9b.value = txt1b.value*lst9a.options[lst9a.selectedIndex].value/100;
daysAROutstanding.value = Math.round(txt2.value/txt1a.value*30);
daysOrderToPaid.value = Math.round(parseFloat(txt10.value)+parseFloat(daysAROutstanding.value.replace(/,/g, "")));
percentCashFlowIncrease.value = Math.round(parseFloat(daysAROutstanding.value.replace(/,/g, ""))/parseFloat(daysOrderToPaid.value.replace(/,/g, ""))*100);
dollarTradeDiscountSaves.value = commas(Math.round(txt6.value/100*txt3a.value));
dollarAdditionalSales.value = commas(Math.round((parseFloat(txt1b.value)-parseFloat(txt3a.value))/txt1b.value*txt9b.value));
dollarCurrentFinanceCost.value = commas(Math.round(((txt1a.value*(1-(parseFloat(txt3b.value/100)))*(daysOrderToPaid.value.replace(/,/g, "")/365))*12)*txt8.value/100));
dollarProfitIncrease.value = commas(Math.round(parseFloat(dollarTradeDiscountSaves.value.replace(/,/g, ""))+parseFloat(dollarAdditionalSales.value.replace(/,/g, ""))+parseFloat(dollarCurrentFinanceCost.value.replace(/,/g, ""))));
dollarPotentialCost.value = commas(Math.round(parseFloat((parseFloat(txt1b.value/(365/parseFloat(daysAROutstanding.value.replace(/,/g, ""))))+parseFloat(txt9b.value/(365/parseFloat(daysAROutstanding.value.replace(/,/g, "")))))*(parseFloat(primerate)/100))+parseFloat(((parseFloat(txt1b.value)+parseFloat(txt9b.value))*0.02))));
dollarNetProfits.value = commas(Math.round(parseFloat(dollarProfitIncrease.value.replace(/,/g, ""))-parseFloat(dollarPotentialCost.value.replace(/,/g, ""))));
percentProfitIncrease.value = Math.round(100*(parseFloat(dollarNetProfits.value.replace(/,/g, ""))/(txt1b.value*(txt4.value/100))));
dblPrimeRate.value = primerate;

if (parseFloat(dollarNetProfits.value)>0)
boolYesNo.value = "YES";
else
boolYesNo.value = "NO";
}
}
//-->
</SCRIPT>
<LINK href="Factoring Calculator_files/ie.css" rel=stylesheet>
<META
content="See if factoring could increase your company's cash flow by running your A/R numbers."
name=description>
<META content="Microsoft FrontPage 5.0" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0
onload="MM_checkBrowser(4.0,0,1,4.0,0,1,1,'../home_gen.asp','');return document.MM_returnValue"
marginheight="0" marginwidth="0">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR vAlign=top bgColor=#003366>
<TD height=60>&nbsp;</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top width=144 bgColor=#003366>
&nbsp;</TD>
<TD vAlign=top>
<TABLE height="100%" cellPadding=5 width="100%" border=0>
<TBODY>
<TR class=BodyText vAlign=top>
<TD class=BodyText>
<FORM name=frmEval
onsubmit="MM_validateForm('txt1a','','RisNum','txt2','','RisNum','txt3a','','RisNum','txt4','','RisNum','txt6' ,'','RisNum','txt8','','RisNum','txt10','','RisNum');return document.MM_returnValue"
action=evalresult.asp method=post>
<TABLE cellPadding=2 border=0>
<TBODY>
<TR vAlign=top>
<TD colSpan=4>
<H1>Factoring Calculator</H1>
<P class=BodyText>To find out if factoring makes sense for
your business, please respond to each question; enter 0 if
there is no value. </P>
</TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>1.</TD>
<TD class=Footer>What is your average monthly sales volume?
</TD>
<TD class=Footer align=right width=18>$</TD>
<TD class=Footer width=100><INPUT class=Footer
onchange=txt1a_onChange() size=8 name=txt1a> </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>&nbsp;</TD>
<TD class=Footer>This suggests your annual sales volume equals
</TD>
<TD class=Footer align=right width=18>$</TD>
<TD class=Footer width=100><INPUT class=Footer disabled size=8
name=txt1b> </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>2.</TD>
<TD class=Footer>What is your current outstanding balance of
accounts receivable? </TD>
<TD class=Footer align=right width=18>$</TD>
<TD class=Footer width=100><INPUT class=Footer size=8
name=txt2> </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>3.</TD>
<TD class=Footer>What is the dollar amount of your annual cost
of goods sold? (How much does it cost to make or provide your
product or service?) </TD>
<TD class=Footer align=right width=18>$</TD>
<TD class=Footer width=100><INPUT class=Footer
onchange=txt3a_onChange() size=8 name=txt3a> </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>&nbsp;</TD>
<TD class=Footer>Your Answer to Question #3 suggests an annual
Gross Profit Margin of: </TD>
<TD class=Footer align=right width=18>&nbsp;</TD>
<TD class=Footer width=100><INPUT class=Footer disabled size=8
name=txt3b> % </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>4.</TD>
<TD class=Footer>What is your Company's annual profit margin?
</TD>
<TD class=Footer align=right width=18>&nbsp;</TD>
<TD class=Footer width=100><INPUT class=Footer size=8
name=txt4> % </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>5.</TD>
<TD class=Footer>Do your vendors offer trade discounts if you
pay early? </TD>
<TD class=Footer align=right width=18>&nbsp;</TD>
<TD class=Footer width=100><SELECT class=Footer
onchange=lst5_onChange() name=lst5> <OPTION value=Yes
selected>Yes</OPTION> <OPTION value=No>No</OPTION></SELECT>
</TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>6.</TD>
<TD class=Footer>If yes, how much do they offer in discounts?
</TD>
<TD class=Footer align=right width=18>&nbsp;</TD>
<TD class=Footer width=100><INPUT class=Footer size=8
name=txt6> % </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>7.</TD>
<TD class=Footer>How are you financing your business today?
<BR><INPUT type=checkbox value=checkbox name=chk7a>
Bank<BR><INPUT type=checkbox value=checkbox name=chk7b> Credit
Cards<BR><INPUT type=checkbox value=checkbox name=chk7c>
Family and Friends<BR><INPUT type=checkbox value=checkbox
name=chk7d> Other Loan Sources</TD>
<TD class=Footer align=right width=18>&nbsp;</TD>
<TD class=Footer width=100>&nbsp;</TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>8.</TD>
<TD class=Footer>What is the average annual cost of this
financing? (percentage rate) </TD>
<TD class=Footer align=right width=18>&nbsp;</TD>
<TD class=Footer width=100><INPUT class=Footer size=8
name=txt8> % </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>9.</TD>
<TD class=Footer>How much more business could your company do
if you had money today to buy materials? </TD>
<TD class=Footer align=right width=18>&nbsp;</TD>
<TD class=Footer width=100><SELECT class=Footer
onchange=lst9a_onChange() name=lst9a> <OPTION value=0
selected>0</OPTION> <OPTION value=10>10</OPTION> <OPTION
value=20>20</OPTION> <OPTION value=30>30</OPTION> <OPTION
value=40>40</OPTION> <OPTION value=50>50</OPTION> <OPTION
value=75>75</OPTION> <OPTION value=100>100</OPTION> <OPTION
value=150>150</OPTION> <OPTION value=200>200</OPTION></SELECT>
% </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>&nbsp;</TD>
<TD class=Footer>This would translate into an incremental
dollar amount in sales of: </TD>
<TD class=Footer align=right width=18>$</TD>
<TD class=Footer width=100><INPUT class=Footer disabled size=8
name=txt9b> </TD></TR>
<TR vAlign=top>
<TD class=Footer width=22>10.</TD>
<TD class=Footer>How long does it take you to make or provide
your product or service? </TD>
<TD class=Footer align=right width=18>&nbsp;</TD>
<TD class=Footer width=100><INPUT class=Footer size=8
name=txt10> days </TD></TR></TBODY></TABLE><INPUT type=hidden
name=daysAROutstanding> <INPUT type=hidden name=daysOrderToPaid>
<INPUT type=hidden name=percentCashFlowIncrease> <INPUT type=hidden
name=dollarTradeDiscountSaves> <INPUT type=hidden
name=dollarAdditionalSales> <INPUT type=hidden
name=dollarCurrentFinanceCost> <INPUT type=hidden
name=dollarProfitIncrease> <INPUT type=hidden
name=dollarPotentialCost> <INPUT type=hidden name=dollarNetProfits>
<INPUT type=hidden name=percentProfitIncrease> <INPUT type=hidden
name=boolYesNo> <INPUT type=hidden name=dblPrimeRate>
<P align=left><INPUT class=BodyText onclick=btnCalculate_onClick(5) type=submit value=Calculate name=btnCalculate>
<INPUT class=BodyText type=reset value=Clear name=btnClear>
</P></FORM></TD>
<TD class=Footer width=170><BR>
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=Footer width=144 bgColor=#003366 rowSpan=2>&nbsp; </TD>
<TD class=Footer rowSpan=2>
<TABLE cellPadding=4 width="100%" border=0>
<TBODY>
<TR>
<TD class=Footer>&nbsp;</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>

--------------------------------------
Please what should I do to display the results on another page.

Thank you.

Kor
12-19-2003, 09:08 AM
It depends on what kind of page is that your another page

1. if it is a frame or an iframe, the reference for get a value is

parent.

2. if it is the parent page, the reference is

top.frames[[i]name[/]].

3. if it is a popup or a simple new page, the reference is

window.opener.

NOTE: in the 3rd example the new page MUST have been opened from the main page (href or javascript code), not by its own.

For instance (3rd case example), if you have in the main page something like

<form>
<input name="inputname" value="">
</from>

to get the input's value from the main page to a second page (opened from the main) you have to use, in the second page, something like:

var thatvalue = window.opener.document.forms[0].inputname.value;

Kor
12-19-2003, 09:08 AM
top.frames[name].

krikri
12-19-2003, 04:08 PM
Hi KOR,

Now I see the reply. I understand all you said but please

1. How can I develop the results page
2. What name should I give to the results page?
3. Can you design the results page for me
4. In which folder should I put the results page

For example, I put in some figures in the form and this page resulted.

------------------------------

<html>
<head>
<title>Factoring calculator results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language=javascript>
<!--
function lst_onChange(lst) {
var v = lst.options[lst.selectedIndex].value;
if ((v.length > 1) && (v != "null")) {
window.location.href = v;
}
}

function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v3.0
var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);
if (app.indexOf('Netscape') != -1) {
if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
} else if (app.indexOf('Microsoft') != -1) {
if (version >= IEvers || verStr.indexOf(IEvers) != -1)
{if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}
else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
} else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }
}
//-->
</script>
<link rel="stylesheet" href="ie.css">
<!-- #BeginEditable "description" -->
<meta name="description" content="Your individual results.">
<!-- #EndEditable -->
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_checkBrowser(4.0,0,1,4.0,0,1,1,'home_gen.asp','');return document.MM_returnValue">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#003366" valign="top">
<td height="60">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> <!-- #BeginEditable "contents" -->
<table width="100%" border="0" cellpadding="5" height="100%">
<tr valign="top" class="BodyText">
<td class="BodyText">
<table width="460" border="0" cellpadding="2">
<tr>
<td class="Footer" width="345">Does factoring makes sense to you
under this scenario? </td>
<td class="FooterBold" width="84">YES</td>
</tr>
<tr>
<td class="Footer" width="345">&nbsp;</td>
<td class="Footer" width="84">&nbsp;</td>
</tr>
<tr>
<td class="FooterBold" width="345">How much money could you save?
</td>
<td class="Footer" width="84">&nbsp;</td>
</tr>
<tr>
<td class="Footer" width="345">Your opportunity to save money
using trade discounts equals </td>
<td class="Footer" width="84">$ 7,950
annually </td>
</tr>
<tr>
<td class="Footer" width="345">You could buy more product and
make more sales resulting in additional gross profit of </td>
<td class="Footer" width="84">$ 48,287</td>
</tr>
<tr>
<td class="Footer" width="345">You would eliminate your current
financing cost of </td>
<td class="Footer" width="84">$ 1,203
annually </td>
</tr>
<tr>
<td class="Footer" width="345">Gross profit increase if you factor
would total </td>
<td class="Footer" width="84">$ 57,440</td>
</tr>
<tr>
<td class="Footer" width="345">Potential cost of factoring (assumes
a discount factor of 2% and a price of prime plus 2%
where prime rate is 5%.) </td>
<td class="Footer" width="84"><font color="#CC0000">&lt;$ 8,030&gt;</font></td>
</tr>
<tr>
<td class="Footer" width="345">&nbsp;</td>
<td class="Footer" width="84">&nbsp;</td>
</tr>
<tr>
<td class="FooterBold">Net Incremental Pre-Tax Profits to your
business by Factoring </td>
<td class="Footer">$ 49,410</td>
</tr>
<tr>
<td class="Footer">As a percent of current sales, your business
profits could be increased by </td>
<td class="Footer">0 %</td>
</tr>
<tr>
<td class="Footer">The average number of days that your A/R is
outstanding equals </td>
<td class="Footer">31 days</td>
</tr>
<tr>
<td class="Footer">From the day you receive an order until the
day you get paid takes </td>
<td class="Footer">36 days </td>
</tr>
<tr>
<td class="Footer">If you could receive money the day you ship
your order, you could improve your cash flow cycle by </td>
<td class="Footer">86 %</td>
</tr>
</table>
<p class="BodyText"><a href="contact.asp">Contact us</a> to find out
how to set up a factoring program. </p>
</td>
</tr>
</table>
<!-- #EndEditable --> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing=0>
<tr>
<td class="Footer" rowspan="2" width="144" bgcolor="#003366">&nbsp; </td>
<td class="Footer" rowspan="2">
<table width="100%" border="0" cellpadding="4">
<tr >
<td class="Footer"><a href="privacy.asp">Privacy
Policy</a> | <a href="terms.asp">Terms of Use</a></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

-------------------------------------------------------------------
How can I create my own form? How should I amend this html and name it so that when I fill the form the results will show. I cant develop the results form at all.

Thank you.

Krikri.

Kor
12-20-2003, 09:17 AM
let's clarify some things:

You have a first page with a form in it. The form's action sends some values to a CGI, a server-side application, which is a third part.

In your case, that application is, as far as I can see, evalresult.asp. Now, this application does whatever it does (You or those who build it must know) and I think that one of those things it does is to generate a new page, I think the second one which you have posted here.

OK, which is your problem from now once?

- You want to modify somehow that second page? You must modify that ASP application for that.

- You want to store/modify/see/administrate those data? You need to have acces to that database, ask the webmaster for.

- You want, the same time, use those values for using them in third page? You may use that window.opener reference I was talking about.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum