Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

Quantity input on E-commerce Site

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
ensa
Asked:
ensa
1 Solution
 
webwomanCommented:
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
 
ensaAuthor Commented:
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
 
AvocadoIsleCommented:
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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
webwomanCommented:
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
 
ensaAuthor Commented:
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
 
ensaAuthor Commented:
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
 
ensaAuthor Commented:
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
 
ensaAuthor Commented:
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
 
webwomanCommented:
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
 
ensaAuthor Commented:
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
 
ensaAuthor Commented:
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
 
coreybryantCommented:
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now