Solved

Quantity input on E-commerce Site

Posted on 2002-04-12
12
234 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:ensa
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

762 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

10 Experts available now in Live!

Get 1:1 Help Now