473,776 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP form not working

Hello,

I have this ecom page that i am making where customers can select to choose
additional licenses before they purchase. I have that part working with
javascript.

Problem is that when the selection is made and you hit the add but it isn't
sending to the right pages (and i think i need to do it in another statemen
instead of a if..then, since there will be at least 16 conditions here.

<%
Response.Expire s = -1000
Response.Buffer = True

If Request.Form("p urchase") ="true" Then
BuyCrossSale
Else
CrossSale
End If

Sub BuyCrossSale
Dim prod2, prod3, one, two, three, tons

one = "1"
two= "2"
three = "3"
tons = "99"

prod2 = Request.Form("p rod2")
prod3 = Request.Form("p rod3")

If Request.Form("l icenses") = one AND prod2 = "on" AND prod3 = "on" Then
Response.Redire ct "http://www.msn.com"
Else

If Request.Form("l icenses") = one AND prod3 = "on" Then
Response.Redire ct "http://www.dogpile.com "
Else

If Request.Form("l icenses") = one AND prod2 = "on" Then
Response.Redire ct "http://www.google.com"
Else

If Request.Form("l icenses") = one Then
Response.Redire ct "http://www.google.com"
Else

Response.Redire ct "http://ps2.ign.com"

CrossSale
End If
End If
End If
End If
End Sub

%>

<script language="JavaS cript" type="text/JavaScript">
<!--
function MM_preloadImage s() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0; i<a.length;
i++)
if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function UpdateTotal()
{

var product_name = "MAIN";
var regular = 0;
var saved = 0;
var total = 0;

var Ptotal = 0;
var Pregular = 0;

if(document.get ElementById('fr m').licenses.va lue == 1)
{
total += 19.99;
regular += 19.99 * 2;
}
else if(document.get ElementById('fr m').licenses.va lue == 2)
{
product_name = "MAIN x 2";
total += 29.99;
regular += 19.99 * 2 * 2;
}
else if(document.get ElementById('fr m').licenses.va lue == 3)
{
product_name = "MAIN x 3";
total += 39.99;
regular += 19.99 * 2 * 3;
}
else if(document.get ElementById('fr m').licenses.va lue == 99)
{
product_name = "MAIN Unlimited";
total += 69.99;
regular += 19.99 * 2 * 4;
}

Ptotal = total;
Pregular = regular;
if(document.get ElementById('fr m').prod2.check ed)
{
document.getEle mentById("row_a p").style.displ ay = '';
total += 9.99;
regular += 9.99;
}
else
{
document.getEle mentById("row_a p").style.displ ay = 'none';
}

if(document.get ElementById('fr m').prod3.check ed)
{
document.getEle mentById("row_a a").style.displ ay = '';
total += 6.99;
regular += 39.99;
}
else
{
document.getEle mentById("row_a a").style.displ ay = 'none';
}

saved = regular - total;
if(document.all ) //ie
{
document.all("p roduct_name").i nnerText = product_name;
document.all("p roduct_price"). innerHTML =
formatAsMoney(P total).toString () + " <font size='1' color='#ffffff'
face='Verdana'> <b>(<s>" + formatAsMoney(P regular).toStri ng() +
"</s>)</b></font>";

document.all("t otal_purchase") .innerText = '$' +
formatAsMoney(t otal).toString( );
}
else
{
document.getEle mentById("produ ct_name").textC ontent = product_name;
document.getEle mentById("produ ct_price").inne rHTML =
formatAsMoney(P total).toString () + " <font size='1' color='#ffffff'
face='Verdana'> <b>(<s>" + formatAsMoney(P regular).toStri ng() +
"</s>)</b></font>";
document.getEle mentById("total _purchase").tex tContent = '$' +
formatAsMoney(t otal).toString( );
}

return true;
}
function formatAsMoney(m nt)
{
mnt -= 0;
mnt = (Math.round(mnt *100))/100;
return (mnt == Math.floor(mnt) ) ? mnt + '.00'
: ( (mnt*10 == Math.floor(mnt* 10)) ?
mnt + '0' : mnt);
}

//-->
</script>
</head>
<body><% Sub CrossSale %>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<th scope="col"</th>
</tr>
<tr>
<td><table width="750" border="1" align="center" cellpadding="0"
cellspacing="0" bordercolor="#0 00000" class="bground" >
<tr>
<th><table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th<form method="post" action="work.as p" target="_top"
name="frm" id="frm">
<input type="hidden" name="purchase" value="true">

<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th width="243" valign="top" align="center">
<table width="100%" border="0" align="center" cellpadding="0"
cellspacing="0" >
<tr>
<td><table width="95%" border="0"
align="center" cellpadding="0" cellspacing="0" >
<tr>
<td align="center" class="product" >Your
Current Order:</td>
</tr>
<tr>
<td><table width="95%" border="2"
align="center" cellpadding="1" cellspacing="2" bgcolor="#00336 4" class="para">
<!--DWLayoutTable-->
<tr>
<td width="113" align="left"
class="parabold white" id="product_nam e">MAIN</td>
<td width="104" align="right"
class="parabold white" id="product_pri ce">19.99 <span
class="parabold white2">(<s>39. 99</s>)</span></td>
</tr>
<tr id="row_ap">
<td align="left"
class="parabold white">PRODUCT 2 </td>
<td align="right"
class="parabold white"><b>9.99 <span
class="parabold white2">(<s>19. 99</s>)</span></td>
</tr>
<tr id="row_aa">
<td align="left"
class="parabold white">PRODUCT 3 </td>
<td align="right"
class="parabold white">6.99 <span
class="parabold white2">(<s>9.9 9</s>)</span></td>
</tr>
<tr>
<td style="padding: 0px;" colspan="2"
valign="top"></td>
</tr>
<tr>
<td align="left"
class="parabold red">Your Total:</td>
<td align="right"
class="parabold red" id="total_purch ase">$36.97</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></th>
<th width="457" valign="top"<ta ble width="100%"
border="0" cellpadding="0" cellspacing="0" id="AutoNumber2 " class="para">
<tr>
<td colspan="2"><di v align="center">
<select name="licenses" id="licenses"
onChange="retur n UpdateTotal();" >
<option value="1">Singl e Computer
$19.99</option>
<option value="2">2 Computers $29.99</option>
<option value="3">3 Computers $39.99</option>
<option value="99">Unli mited Computer
License $69.99</option>
</select>
</div></td>
</tr>
<tr>
<td colspan="2"</td>
</tr>
<tr>
<td colspan="2" align="left" class="para"><b r>
<input name="prod2" type="checkbox" id="prod2"
onClick="return UpdateTotal();" value="ON" checked="CHECKE D" />
Yes, Include PRODUCT 2<br>
<input name="prod3" type="checkbox" id="prod3" onClick="return
UpdateTotal();" value="ON" checked="CHECKE D" />
Yes, Include PRODUCT 3</td>
</tr>
<tr>
<td align="left" valign="top"</td>
<td align="left" class="para"><b r>
<br>
<a value="Add" name="yes" type="submit">
<input type="submit" value="Add" name="yes">
</a></td>
</tr>
</table>
</th>
</tr>
</table>
</form>
</th>
</tr>
<tr>
<td valign="top" align="center" class="footer"</td>
</tr>
</table></th>
</tr>
</table></td>
</tr>
<tr>
<td</td>
</tr>
</table><% End Sub %>

Any help is greatly appreciated :)
Aug 31 '06 #1
3 2046

Athmaus wrote:
Hello,

I have this ecom page that i am making where customers can select to choose
additional licenses before they purchase. I have that part working with
javascript.

Problem is that when the selection is made and you hit the add but it isn't
sending to the right pages (and i think i need to do it in another statemen
instead of a if..then, since there will be at least 16 conditions here.

<%
Response.Expire s = -1000
Response.Buffer = True

If Request.Form("p urchase") ="true" Then
BuyCrossSale
Else
CrossSale
End If

Sub BuyCrossSale
Dim prod2, prod3, one, two, three, tons

one = "1"
two= "2"
three = "3"
tons = "99"

prod2 = Request.Form("p rod2")
prod3 = Request.Form("p rod3")

If Request.Form("l icenses") = one AND prod2 = "on" AND prod3 = "on" Then
Response.Redire ct "http://www.msn.com"
Else

If Request.Form("l icenses") = one AND prod3 = "on" Then
Response.Redire ct "http://www.dogpile.com "
Else

If Request.Form("l icenses") = one AND prod2 = "on" Then
Response.Redire ct "http://www.google.com"
Else

If Request.Form("l icenses") = one Then
Response.Redire ct "http://www.google.com"
Else

Response.Redire ct "http://ps2.ign.com"

CrossSale
End If
End If
End If
End If
End Sub

%>

<script language="JavaS cript" type="text/JavaScript">
<snip a load of javascript>
>
Any help is greatly appreciated :)
The (probable) reason that no one has so far responded to your post is
that you haven't really elucidated your problem. "It isn't sending to
the right pages" needs a bit more description, as does the purpose of
your code. It is unlikely that anyone is going to plough through all
the code you posted to try to establish your intended logic, especially
as it may be faulty.

Verify that the javascript is working correctly by using document.write
at key points to verify values, and that the values you are expecting
to be passed in the vbscript are really as they should be by using
response.write. You may find the root of the problem that way. If
not, get back to us with a bit more detail and a bit less (client side)
javascript.

--
Mike Brind

Sep 2 '06 #2
yeah the javascript is 100% working and i got the aps works now as i replaced
the "on" with "true" I just wish i could streamline the code some more

tahnsk

"Mike Brind" wrote:
>
Athmaus wrote:
Hello,

I have this ecom page that i am making where customers can select to choose
additional licenses before they purchase. I have that part working with
javascript.

Problem is that when the selection is made and you hit the add but it isn't
sending to the right pages (and i think i need to do it in another statemen
instead of a if..then, since there will be at least 16 conditions here.

<%
Response.Expire s = -1000
Response.Buffer = True

If Request.Form("p urchase") ="true" Then
BuyCrossSale
Else
CrossSale
End If

Sub BuyCrossSale
Dim prod2, prod3, one, two, three, tons

one = "1"
two= "2"
three = "3"
tons = "99"

prod2 = Request.Form("p rod2")
prod3 = Request.Form("p rod3")

If Request.Form("l icenses") = one AND prod2 = "on" AND prod3 = "on" Then
Response.Redire ct "http://www.msn.com"
Else

If Request.Form("l icenses") = one AND prod3 = "on" Then
Response.Redire ct "http://www.dogpile.com "
Else

If Request.Form("l icenses") = one AND prod2 = "on" Then
Response.Redire ct "http://www.google.com"
Else

If Request.Form("l icenses") = one Then
Response.Redire ct "http://www.google.com"
Else

Response.Redire ct "http://ps2.ign.com"

CrossSale
End If
End If
End If
End If
End Sub

%>

<script language="JavaS cript" type="text/JavaScript">

<snip a load of javascript>

Any help is greatly appreciated :)

The (probable) reason that no one has so far responded to your post is
that you haven't really elucidated your problem. "It isn't sending to
the right pages" needs a bit more description, as does the purpose of
your code. It is unlikely that anyone is going to plough through all
the code you posted to try to establish your intended logic, especially
as it may be faulty.

Verify that the javascript is working correctly by using document.write
at key points to verify values, and that the values you are expecting
to be passed in the vbscript are really as they should be by using
response.write. You may find the root of the problem that way. If
not, get back to us with a bit more detail and a bit less (client side)
javascript.

--
Mike Brind

Sep 3 '06 #3
=?Utf-8?B?QXRobWF1cw= =?= wrote on 03 sep 2006 in
microsoft.publi c.inetserver.as p.general:
If Request.Form("l icenses") = one AND prod2 = "on" AND prod3 = "on"
Then
Response.Redire ct "http://www.msn.com"
Else

If Request.Form("l icenses") = one AND prod3 = "on" Then
Response.Redire ct "http://www.dogpile.com "
Else

If Request.Form("l icenses") = one AND prod2 = "on" Then
Response.Redire ct "http://www.google.com"
Else
the above is included in the below if clause,
because they both goto Google!

If Request.Form("l icenses") = one Then
Response.Redire ct "http://www.google.com"
Else

Response.Redire ct "http://ps2.ign.com"

CrossSale
End If
End If
End If
End If
[please do not toppost on usenet]
yeah the javascript is 100% working and i got the aps works now as i
replaced the "on" with "true" I just wish i could streamline the code
some more
A lot of streamlining cn be done to the above:

vbs hase "elseif":

If Request.Form("l icenses") = one AND prod2 = "true"_
AND prod3 = "true" Then
Response.Redire ct "http://www.msn.com"
ElseIf Request.Form("l icenses") = one AND prod3 = "true" Then
Response.Redire ct "http://www.dogpile.com "
'''ElseIf Request.Form("l icenses") = one AND prod2 = "true" Then
''' Response.Redire ct "http://www.google.com"
ElseIf Request.Form("l icenses") = one Then
Response.Redire ct "http://www.google.com"
Else
Response.Redire ct "http://ps2.ign.com"
CrossSale ' A line after a redirect is not executed!!!!!
End If

in short:

If Request.Form("l icenses") = one AND prod2 = "true"_
AND prod3 = "true" Then
Response.Redire ct "http://www.msn.com"
ElseIf Request.Form("l icenses") = one AND prod3 = "true" Then
Response.Redire ct "http://www.dogpile.com "
ElseIf Request.Form("l icenses") = one Then
Response.Redire ct "http://www.google.com"
Else
Response.Redire ct "http://ps2.ign.com"
End If

however this perhaps is even simpler:

If Request.Form("l icenses") <one Then
Response.Redire ct "http://ps2.ign.com"
ElseIf prod3 <"true" Then
Response.Redire ct "http://www.google.com"
ElseIf prod2 = "true" Then
Response.Redire ct "http://www.msn.com"
Else
Response.Redire ct "http://www.dogpile.com "
End If

Again, since after a redirect there is no execution,
you could use the ancient "If this Then that" syntax:

nolicence = (Request.Form(" licenses") <one)
If nolicence Then Response.Redire ct "http://ps2.ign.com"
If prod3 <"true" Then Response.Redire ct "http://www.google.com"
If prod2 = "true" Then Response.Redire ct "http://www.msn.com"
Response.Redire ct "http://www.dogpile.com "

Enough steamlining logic?

Oh wait, perhaps you ment boolean True, not "true" as a string?:

licence = (Request.Form(" licenses") = one)
If NOT licence Then Response.Redire ct "http://ps2.ign.com"
If NOT prod3 Then Response.Redire ct "http://www.google.com"
If prod2 Then Response.Redire ct "http://www.msn.com"
Response.Redire ct "http://www.dogpile.com "
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2891
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time it took to go to a record was very slow. The go to mechanism was a box that the user typed the index value into a combo box, with very simple code attached: with me.RecordsetClone .FindFirst " = " & me.cboGoTo If Not .NoMatch Then Me.Bookmark...
25
10265
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
8
4938
by: CJack | last post by:
hy, I have an mdi application, i create a child form and I want to know when a button is pressed while that child form is loaded. I have this code: private void frmTestBaby_KeyUp(object sender, System.EventArgs e) { MessageBox.Show("keyboard button pressed!"); } Following is the code to load the frmTestBaby
4
1692
by: Michael | last post by:
Hi Everyone, I'm hoping someone out there can give me some guidance. I'm currenlty using VS2005 and the other day the Form Wizzard stopped working. What I mean, is that the wizzard no longer creates the code in the "Windows Form Designer generated code" section. As a matter a fact, if I add a new form to the project, that section is not even there. The only code that you will see is: Public Class Form2 End Class
14
3431
by: Galen Somerville | last post by:
My current screen resolution is set to 1024 x 768. My form size always comes up as 1032 x 748. I have tried the help sample ' Retrieve the working rectangle from the Screen class ' using the PrimaryScreen and the WorkingArea properties. Dim workingRectangle As System.Drawing.Rectangle = _ Screen.PrimaryScreen.WorkingArea ' Set the size of the form slightly less than size of
13
70006
by: deko | last post by:
I have a basic feedback form with a submit button. After the "send" button is clicked, I want the user to be redirected to a different page that says "Your message has been sent." How do I do this? I've tried using: header("Location:http://www.mysite.com/send-confirm.php");
6
6899
by: Harshpandya | last post by:
Hi all, I am working on the form in which you fill out the whole PHP form and e mail that details to someone. It is working fine. But now i want to send the same form to be sent to different people and user should be able choose the check boxes to whom they want to send e mail to. I write some code simple If else conditions but i think i am making some mistakes. Because when i tried - it is not sending them e mails. Here is my code. I...
0
1974
by: asad56 | last post by:
I am workin with a superstore managment project. I connect Access database with main form . Then it work properly. But now I connect same database with another table or field in another form which is child of main form not working. Main form stil working but when try to open child a message show as Please select a valid SQL statement as "Select", "Delet" or "Updat" I am working with Access . I connect database in...
7
9372
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should display the Windows form. The form is being displayed but the command only returns when the form is closed. I want the command line to return immediately, leaving the form displayed.
11
2278
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server 6.something I think and running as a service, Using NoteTab Pro as an IDE (works well). If you need more, just ask. In one functioning form:
0
9627
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9922
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8951
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7469
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6721
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3621
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2859
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.