Solved

Quantity input on E-commerce Site

Posted on 2002-04-12
12
241 Views
Last Modified: 2013-12-24
Hi,

I'm currently building an E-commerce site as part of a University project. I'm using Frontpage 2000 and Shopassistant Pro Classic. I want to add a one line text box that would allow the user to input the quantity they require and then hit the add to basket posimage or text hyperlink. My tutor say this is only possible if I am using a form button to add to basket, but I have seen other websites using an image and a quantity field together, whats the crack?  Here's some of the code, apparently should work if I was using a form button:

<form>
<a href="javascript: top.newchoice('Jamiriquai - A Funk Odysee','Jam01','','', 8.29,this.form.Qty.value, '', 1)"><img border="0" src="images/addbasket.png" align="middle" width="57" height="52"></a><font face="Verdana" size="1"><a href="javascript: top.newchoice('Jamiriquai - A Funk Odysee','Jam01','','', 8.29,this.form.Qty.value, '', 1)">Add</a>
     </font><input type=text name=Qty size=3 value=1 onchange='top.qty_fix(this)'>
     <font face="Verdana" size="1">
     </font> <font face="Verdana" size="1"><a href="javascript: top.newchoice('Jamiriquai - A Funk Odysee','Jam01','','',      8.29,this.form.Qty.value, '', 1)">To Basket</a></font></p>
</form>

I would greatly appreciate any suggestions.

Thanx
0
Comment
Question by:ensa
12 Comments
 
LVL 19

Expert Comment

by:webwoman
ID: 6936825
Where's the script? And did you write the script or are you totally dependent on FrontPage?

Because unless you can write your own script, and debug it, you're not going to be able to do what you want. If you understand javascript, and are comfortable writing your own code, it's not tough at all.

But from the question, I'm assuming you're not coding anything yourself.  

Just a general note -- if you're planning on doing web development/design as a business/job, learn how to code your own HTML, javascript, asp, etc. You'll be expected to. You'll NEED to. FP doesn't do everything, and it does many things exceedingly BAD.

A note on what you have...
I'm assuming you know that this will go nowhere, that the form will do nothing, and that your quotes are wrong.

What javascript errors do you get? Because I'm sure you get a bunch...
0
 

Author Comment

by:ensa
ID: 6937043
webwomen,

Thanks for replying. Firstly, I'm doing a business studies degree, not a computing degree so its not what I'm going to be doing as a job. We're given a bit of guidence but after that we are pretty much left to work it out ourselves.. hence my position. I have a basic understanding of HTML and javascript from teaching myself but still rely on FP a fair bit. The code works fine when published if I set the quantity to 1 (I don't need to use a form at all then of course).  The basket is updated with no problems because Shop@ssistant understands the call.The specific error I get is 'object doesn't support this property or method'.

Ensa
0
 
LVL 2

Expert Comment

by:AvocadoIsle
ID: 6937218
Ensa -

If I understand your question correctly, you want to use an image instead of the form button.  Here's a way to do that:

<INPUT type="image" src="images/yourimage.gif" width="WW" height="HH" border="0" alt="Add to Basket">

This image will function like the submit button for the form.  Of course, substitute the proper image path/name and height and width attributes.

HTH
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6937369
No, just setting an image type won't do anything. You haven't told it to do anything. It won't function AT ALL like that.

If you want it to be a submit button, you define it that way. That's not what you want if I read it correctly.

You know a bit of HTML and javascript, which is great. What you're trying to do is correct, you're just not using the right syntax.

<a href="javascript: top.newchoice('Jamiriquai - A Funk Odysee','Jam01','','', 8.29,this.form.Qty.value,
'', 1)">
You don't have enough quotes, and I'm not sure if you need a period in 8.29 -- that's why I asked for script. I'm not sure what's supposed to be passed back, but it definitely needs more quotes.

Anything that is between commas needs quotes. Single quotes, like the other parameters. Try that, I suspect it will fix your problem. Also take out the space after javascript: -- that could be a problem too.

If that doesn't work, you might need to use <a href="#" onclick="function()"> syntax. And you may not need top in that either. If you have frames, and have named one of them 'top' -- change that immediately. Top is a reserved word and naming a frame that will cause all sorts of headaches.
0
 

Author Comment

by:ensa
ID: 6937434
thanks for help so far both,

Avoc, tried your idea and that seemed to work but it only updated the cookie, it didn't go to the basket screen for some reason. so not quite there yet.

webwomen, I've put single quotes on everything on the line including the this.form.qty.value. It didn't bring up an error like the other times but it didn't get the quantity. it puts 'NaN' in the quantity field? Without the quote on the value bit generates errors again. Would it help if I gave you a link to the website I'm working on?
0
 

Author Comment

by:ensa
ID: 6937449
thanks for help so far both,

Avoc, tried your idea and that seemed to work but it only updated the cookie, it didn't go to the basket screen for some reason. so not quite there yet.

webwomen, I've put single quotes on everything on the line including the this.form.qty.value. It didn't bring up an error like the other times but it didn't get the quantity. it puts 'NaN' in the quantity field? Without the quote on the value bit generates errors again. Would it help if I gave you a link to the website I'm working on?
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:ensa
ID: 6937497
Just to compare, this is the code with the form button that works perfectly.

<form>
<p><input type="text" name="Qty4" size="3" value="1"><input type="button" value="Add To Basket" name="b3" onclick="javascript: top.newchoice('Robbie Williams - Swing When you're Winning','Rob01','','', 8.29,this.form.Qty4.value,'',1)"></p>
</form>


Ensa
0
 

Author Comment

by:ensa
ID: 6937563
Just to compare, this is the code with the form button that works perfectly.

<form>
<p><input type="text" name="Qty4" size="3" value="1"><input type="button" value="Add To Basket" name="b3" onclick="javascript: top.newchoice('Robbie Williams - Swing When you're Winning','Rob01','','', 8.29,this.form.Qty4.value,'',1)"></p>
</form>


Ensa
0
 
LVL 19

Accepted Solution

by:
webwoman earned 100 total points
ID: 6937665
NaN means 'not a number'

Pay close attention to how things are named...
this
><input type="text" name="Qty4" size="3" value="1"><input type="button" value="Add To Basket" name="b3"
onclick="javascript: top.newchoice('Robbie Williams - Swing When you're Winning','Rob01','','', 8.29,this.form.Qty4.value,'',1)">

Has a textfield called 'Qty4' , and you're using THAT value, from a button that is a form element.

This
<a href="javascript: top.newchoice('Jamiriquai - A Funk Odysee','Jam01','','', 8.29,this.form.Qty.value,
'', 1)">
HAS NO TEXTFIELD. You're calling the value from a field called 'Qty' -- does such a field exist? If not, you will get errors -- you can't use something that doesn't exist. You're also referencing this.form -- well, it's an image, it's not this.form.

You have to use things correctly. If you call your girlfriend your mother, people are going to give you some strange looks. Same with javascript.

If would be extremely helpful if you could post the script, because without knowing what it's doing and how it's passing things all this is just guessing anyway.
0
 

Author Comment

by:ensa
ID: 6937723
Good point about the image/form, I didn't think of that, that'll explain that one. Regarding the Qty field, there is a field called Qty in the original coding. If you look about half way down the code I gave at the start it is in there. I wanted it to say Add ... To Basket <Image>. I'm unable to give you the script because its all part of the Shop@ssistant Classic program. Thats a generic bit given to us by the uni.
0
 

Author Comment

by:ensa
ID: 6937724
Good point about the image/form, I didn't think of that, that'll explain that one. Regarding the Qty field, there is a field called Qty in the original coding. If you look about half way down the code I gave at the start it is in there. I wanted it to say Add ... To Basket <Image>. I'm unable to give you the script because its all part of the Shop@ssistant Classic program. Thats a generic bit given to us by the uni.
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 9151187
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Webwoman's comment
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

coreybryant
EE Cleanup Volunteer
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now