/    Sign up×
Community /Pin to ProfileBookmark

Major, Major Problems

Hi all,
With my Quote Tool project I have really gotten out of my depth!!!
I have the majority of the coding done with the help of a guy on the forums.

Basically what I would like to have on Page 2 is the user to be asked:

Does file require external review? Yes / No
If yes, then onto Each language that is selected previously add $35.
If no, then there is no need to add a charge.

Now, the next question would be:
Does your file require DTP? Yes / No
If yes, then a small popup would be displayed asking the user for the number of pdf pages required for dtp, and then this cost depending on the number of pages would be also added to the each language selected previously.
Say for 1 pdf page the cost would be $35
2 pages $60 etc etc

If No, then no charge is added to the languages and then a total cost is then displayed to the customer.

If anyone can help I would be very grateful. Please feel free to get in contact with me if you need any further information.

Here is the code that I have so far:

******coding page1*******
<html>

<head>
<title>Symantec Quote Calculator</title>
<script language=”JavaScript” type=”text/javascript”>
<!–

function zxcES(zxcele,zxcstyle,zxcp,zxctxt){
if (typeof(zxcele)==’string’){ zxcele=document.createElement(zxcele); }
for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
if (zxcp){ zxcp.appendChild(zxcele); }
if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
return zxcele;
}

function zxcAddLanguage(zxcobj,zxccount,zxcsel,zxccost,zxcselected){
var zxcfrm=zxcobj.form;
var zxccnt=zxcfrm[zxccount];
zxccnt.value=zxccnt.value.replace(/D/g,”);
var zxcsel=zxcfrm[zxcsel];
var zxcindex=zxcsel.selectedIndex;
var zxcoption=zxcsel.options[zxcindex];
var zxcselected=document.getElementById(zxcselected);
var zxcclds=zxcselected.childNodes;
var zxcadd=true;
for (var zxc0=0;zxc0<zxcclds.length;zxc0++){
if (zxcclds[zxc0].firstChild.data==zxcoption.text){
zxcselected.removeChild(zxcclds[zxc0]);
zxcES(zxcoption,{backgroundColor:’#ffffff’});
zxcadd=false;
break;
}
}
if (zxcindex>0&&zxcadd){
zxcES(‘DIV’,{position:’relative’,left:’0px’,height:’21px’,backgroundColor:’#FFD700′,fontSize:’20px’, borderBottom:’solid black 1px’,paddingLeft:’5px’,paddingRight:’5px’,paddingBottom:’5px’,paddingTop:’5px’},zxcselected,zxcoptio n.text).cost=zxcoption.value;
zxcES(zxcselected,{border:’solid black 1px’,borderBottom:’0px’});
zxcES(zxcoption,{backgroundColor:’#FFFFCC’});
}
zxcsel.selectedIndex=0;
var zxctotal=0;
if (zxccnt.value.length>0){
zxcclds=zxcselected.childNodes;
for (var zxc1=0;zxc1<zxcclds.length;zxc1++){
zxctotal+=zxcclds[zxc1].cost*zxccnt.value;
}
}
zxcfrm[zxccost].value=zxctotal.toFixed(2);
}

//–>
</script>

<style type=”text/css”>

body
{
width: 800px;
height: 600px;
}

fieldset.formFieldSet {
padding: 10px;
width: 325px;
border:solid #000000;
}
<!–
.style2 {font-family: “Symantec Sans Medium”}
–>
</style>
</head>

<body bgcolor=”#FFFF00″>
<fieldset class=”formFieldSet”>
<center>
<form action=”Quote Tool_1.html” onsubmit=”this.YourHiddenElementName.value=cost()” >
<span class=”style2″>Please Input the Word Count Here: </span>
<input name=”count” type=”text” size=”7″ onkeyup=”zxcAddLanguage(this,’count’,’sel’,’cost’,’selected’)”>
<br><br>
<select name=”sel” onchange=”zxcAddLanguage(this,’count’,’sel’,’cost’,’selected’)” >
<option value=”” >Select Languages</option>
<option value=”0.40″ >Arabic</option>
<option value=”0.14″ >Brazilian</option>
<option value=”0.12″ >Czech</option>
<option value=”0.27″ >Danish</option>
<option value=”0.12″ >Dutch</option>
<option value=”0.12″ >Finnish</option>
<option value=”0.22″ >French</option>
<option value=”0.19″ >German</option>
<option value=”0.24″ >Greek</option>
<option value=”0.26″ >Hebrew</option>
<option value=”0.11″ >Hungarian</option>
<option value=”0.19″ >Italian</option>
<option value=”0.27″ >Norwegian</option>
<option value=”0.09″ >Polish</option>
<option value=”0.22″ >Portuguese</option>
<option value=”0.06″ >Russian</option>
<option value=”0.12″ >Spanish</option>
<option value=”0.12″ >Spanish Latin</option>
<option value=”0.29″ >Swedish</option>
<option value=”0.12″ >Turkish</option>
</select>
<br>
<br>
<span class=”style2″>Selected Languages Will Appear Below. To remove languages from the list, simply select the language again from the drop-down box.</span>
<br><br>
<div id=”selected” style=”position:relative;width:100px;” ></div>
<br><br>
<span class=”style2″>Cost In Euros</span>:
<input name=”cost” type=”text” size=”7″ onkeyup=”return false;”>
<br><br>
<input type=”submit” value=”Next”>
<input type=”reset” value=”Clear”>

</form>

<br><br>
<img src=”symyellowback.png” width=”279″ height=”71″>
</form>
</center>
</body>

</html>

*******Coding Page 2*********
<html>
<head>
<title>Symantec Quote Calculator</title>

<script language=”JavaScript” type=”text/javascript”>

var cost;
var exreview;
var dtp;

function add_together (cost, exreview)
{
var excost = cost + exreview;
return excost;
}

final result = excost + dtp

function add_together (excost, dtp)
{
var finresult = excost + dtp;
return finresult;
}
</script>

<style type=”text/css”>

body
{
width: 800px;
height: 600px;
}

fieldset.formFieldSet {
padding: 10px;
width: 325px;
border:solid #000000;
}
<!–
.style2 {font-family: “Symantec Sans Medium”}
–>
</style>

</head>

<body bgcolor=’#FFFF00′>
<fieldset class=”formFieldSet”>
<form>
<input name=”count” type=”text” size=”7″ onkeyup=”zxcAddLanguage(this,’count’,’sel’,’cost’,’selected’)”>
<span class=”style2″><b>Please complete the following fields</b></span>

<br>
<br>

Does document require External Review?:
Yes <input type=”radio” name=”yes” value=”yes”/>
No <input type=”radio” name=”no” value=”no”/>

<br>
<br>
</form>

<form>

Does document require DTP?:
Yes <input type=”radio” name=”yes” value=”yes”/>
No <input type=”radio” name=”no” value=”no”/>

<br>
<br>

<span class=”style2″>Total Cost In Euros</span>:
<input name=”finresult” type=”text” size=”7″ onkeyup=”return false;”>
<br><br>
<div id=”selected” style=”position:relative;width:100px;” ></div>
<br><br>
<input type=”submit” value=”Next”>
<input type=”reset” value=”Clear”>

<br><br>
<img src=”symyellowback.png” width=”279″ height=”71″>
</form>
</body>
</html>

*****End of code******

Many thanks in advance

Claire

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@ChikaraMay 16.2007 — Wow. This is a super complicated way of something something that isn't that complicated.

In order to do the calculations, you need to pass the number of selected languages to page2. Do you have any sort of javascript variable that counts that?
Copy linkTweet thisAlerts:
@ChikaraMay 16.2007 — page1

[CODE]<html>

<head>
<title>Symantec Quote Calculator</title>
<script language="JavaScript" type="text/javascript">

function zxcES(zxcele,zxcstyle,zxcp,zxctxt){
if (typeof(zxcele)=='string')
zxcele=document.createElement(zxcele);

for (key in zxcstyle){
zxcele.style[key]=zxcstyle[key];
}

if (zxcp){
zxcp.appendChild(zxcele);
}

if (zxctxt){
zxcele.appendChild(document.createTextNode(zxctxt));
}
return zxcele;
}//end zxcES

function zxcAddLanguage(zxcobj,zxccount,zxcsel,zxccost,zxcselected){
var totalLangs = document.getElementById('totalLangs');
var zxcfrm=zxcobj.form;
var zxccnt=zxcfrm[zxccount];
zxccnt.value=zxccnt.value.replace(/D/g,'');
var zxcsel=zxcfrm[zxcsel];
var zxcindex=zxcsel.selectedIndex;
var zxcoption=zxcsel.options[zxcindex];
var zxcselected=document.getElementById(zxcselected);
var zxcclds=zxcselected.childNodes;
var zxcadd=true;

for (var zxc0=0;zxc0<zxcclds.length;zxc0++){
if (zxcclds[zxc0].firstChild.data==zxcoption.text){
zxcselected.removeChild(zxcclds[zxc0]);
zxcES(zxcoption,{backgroundColor:'#ffffff'});
zxcadd=false;
break;
}
}

if (zxcindex>0&&zxcadd){
zxcES('DIV',{position:'relative',left:'0px',height:'21px',backgroundColor:'#FFD700',fontSize:'20px', borderBottom:'solid black 1px',paddingLeft:'5px',paddingRight:'5px',paddingBottom:'5px',paddingTop:'5px'},zxcselected,zxcoption.text).cost=zxcoption.value;
zxcES(zxcselected,{border:'solid black 1px',borderBottom:'0px'});
zxcES(zxcoption,{backgroundColor:'#FFFFCC'});
totalLangs.value = (parseInt(totalLangs.value) + 1);
}

if (!zxcadd){
if (parseInt(totalLangs.value) != 0)
totalLangs.value = (parseInt(totalLangs.value) - 1);
}

zxcsel.selectedIndex=0;
var zxctotal=0;

if (zxccnt.value.length>0){
zxcclds=zxcselected.childNodes;
for (var zxc1=0;zxc1<zxcclds.length;zxc1++){
zxctotal+=zxcclds[zxc1].cost*zxccnt.value;
}
}
zxcfrm[zxccost].value=zxctotal.toFixed(2);
}//end zxcAddLanguage

</script>

<style type="text/css">

body
{
width: 800px;
height: 600px;
}

fieldset.formFieldSet {
padding: 10px;
width: 325px;
border:solid #000000;
}
<!--
.style2 {font-family: "Symantec Sans Medium"}
-->
</style>
</head>

<body bgcolor="#FFFF00">
<center>
<form action="webdevhelp1.asp" onsubmit="this.YourHiddenElementName.value=cost();" >
<span class="style2">Please Input the Word Count Here: </span>
<input name="count" type="text" size="7" onkeyup="zxcAddLanguage(this,'count','sel','cost','selected');">
<br><br>
<select name="sel" onchange="zxcAddLanguage(this,'count','sel','cost','selected');" >
<option value="" >Select Languages</option>
<option value="0.40" >Arabic</option>
<option value="0.14" >Brazilian</option>
<option value="0.12" >Czech</option>
<option value="0.27" >Danish</option>
<option value="0.12" >Dutch</option>
<option value="0.12" >Finnish</option>
<option value="0.22" >French</option>
<option value="0.19" >German</option>
<option value="0.24" >Greek</option>
<option value="0.26" >Hebrew</option>
<option value="0.11" >Hungarian</option>
<option value="0.19" >Italian</option>
<option value="0.27" >Norwegian</option>
<option value="0.09" >Polish</option>
<option value="0.22" >Portuguese</option>
<option value="0.06" >Russian</option>
<option value="0.12" >Spanish</option>
<option value="0.12" >Spanish Latin</option>
<option value="0.29" >Swedish</option>
<option value="0.12" >Turkish</option>
</select>
<input type="hidden" id="totalLangs" name="totalLangs" value="0" />
<br>
<br>
<span class="style2">Selected Languages Will Appear Below. To remove languages from the list, simply select the language again from the drop-down box.</span>
<br><br>
<div id="selected" style="position:relative;width:100px;" ></div>
<br><br>
<span class="style2">Cost In Euros</span>:
<input name="cost" type="text" size="7" onkeyup="return false;">
<br><br>
<input type="submit" value="Next">
<input type="reset" value="Clear">

</form>

<br><br>
</form>
</center>
</body>

</html>[/CODE]



Page2
[CODE]
<html>
<head>
<title>Symantec Quote Calculator</title>

<script language="JavaScript" type="text/javascript">

var cost;
var totalLangs;
/*
Lazy programmer. This should be in a method that searches for the correct querystring value. Not assume that it will be in a certain order.
*/
var queryString = location.href.split("&");
for (i=0; i<queryString.length; i++)
alert(queryString[i]) ;

var array = queryString[3].split("=");
cost = parseFloat(array[1]);
var array = queryString[2].split("=");
totalLangs = parseFloat(array[1]);


function updateTotal()
{
var qs = location.href.split("&");
//lazy coder incoming. Fix this to search for the correct value.
var TotalValue = document.getElementById('finresult');
TotalValue.value = parseFloat(TotalValue.value) + (totalLangs * 35);
}

function resetTotal()
{
var TotalValue = document.getElementById('finresult');
TotalValue.value = cost;
}

</script>


<style type="text/css">

body
{
width: 800px;
height: 600px;
}

fieldset.formFieldSet {
padding: 10px;
width: 325px;
border:solid #000000;
}
<!--
.style2 {font-family: "Symantec Sans Medium"}
-->
</style>

</head>

<body bgcolor='#FFFF00'>

<form>
<span class="style2"><b>Please complete the following fields</b></span>

<br>
<br>

Does document require External Review?:
Yes <input type="radio" name="ExternalReview" value="yes" onClick="updateTotal();"/>
No <input type="radio" name="ExternalReview" value="no" onClick="resetTotal();"/>

<br>
<br>
</form>

<form>

Does document require DTP?:
Yes <input type="radio" name="yes" value="yes"/>
No <input type="radio" name="no" value="no"/>

<br>
<br>

<span class="style2">Total Cost In Euros</span>:
<input name="finresult" type="text" size="7" value="<%=Request("cost")%>">
<br><br>
<div id="selected" style="position:relative;width:100px;" ></div>
<br><br>
<input type="submit" value="Next">
<input type="reset" value="Clear">

<br><br>
</form>
</body>
</html>
[/CODE]


Not the cleanest way to do things, but solved some of your problems. I wouldn't pop up a new window, but unhide a div for the 2nd part. I'm lazy so I didn't make this as complete as possible.
×

Success!

Help @clairef spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...