altering values in forms - help please!

This is a discussion on "altering values in forms - help please!" within the JavaScript Forum section. This forum, and the thread "altering values in forms - help please! are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Nov 12th, 2007, 19:58
New Member
Join Date: Nov 2007
Location: Lincoln (UK)
Age: 26
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
altering values in forms - help please!

Hey all, I'm a bit new to JavaScript so bear with me!

My main Website uses the Paypal buy it now buttons which i have found i can manipulate by using drop down menus.

What i Want to do now is capture 2 values from each option (one to alter the despcription one to alter the price) but i'm failing to succeed.

This is what I have (edited out the non relevant bits)

the code bit

HTML: Select all
 function hondachainselect()
{
document.hondachain.item_name.value = document.hondachain.hondachainproduct.value + document.hondachain.hondachain_bike.value 

}

the html form bit

<form target="paypal" action="xxxx" method="post" name="hondachain">

<b> Please Choose your colour:<br></b>
<select name="hondachain_bike" onChange="hondachainselect()">
    <option value=" 0 ">Choose Bike</option>
    <option value="CRF50 04-06" >CRF50 04-06 £19.99</option>
    <option value="CRF70 04-06" >CRF70 04-06 £19.99</option>
    <option value="CRF100 04-06" >CRF100 04-06  £29.99</option>
    
</select>

<br><font size="4"><b>from £19.99</b><br></font>
<input type="hidden" name="hondachainproduct" value="Chain & Sprocket Kit - ">

<input type="image" src="xxxxx" border="0" name="submit" >

<input type="hidden" name="item_name">
<input type="hidden" name="amount">

</form>
with that the "item_name" comes out correctly but I've given up how to get a 2nd value from the options to assign to "amount"

Many thanks in advance for your help!!

Last edited by c010depunkk; Nov 13th, 2007 at 05:36.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Nov 12th, 2007, 20:13
Reputable Member
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
Re: altering values in forms - help please!

Hi

I think this is a paypal issue, i'm not sure but i think with a standard paypal buy it now button you can only pass the item name and price.

there are ways to pass multiple options but it gets complicated(well it was for me).
If you look at my site(contains adult material) and go through the process of add to basket and then checking out to paypal you will see that passing options is possible, however I have used php.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Nov 12th, 2007, 20:16
New Member
Join Date: Nov 2007
Location: Lincoln (UK)
Age: 26
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: altering values in forms - help please!

I'm already passing results from up to 3 drop downs and a hideen value to the "item_name"
just want to grab a related price from 1 drop down and pass that over too.

Trying to save 40 items on one page, If i can crack this it brings it down to just 4 items!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Nov 12th, 2007, 21:12
New Member
Join Date: Nov 2007
Location: Lincoln (UK)
Age: 26
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: altering values in forms - help please!

SOLVED!!!

with an array like this -

HTML: Select all
 function hondachainselect()
{
var bike = new Array(), bi=0;
bike[bi++] = {model:'CRF50 04-06', price:'19.99'};
bike[bi++] = {model:'CRF70 04-06', price:'19.99'};
bike[bi++] = {model:'CRF100 04-06', price:'29.99'};
bike[bi++] = {model:'CR85 R 03-04', price:'34.99'};

var bikevalue = document.hondachain.hondachain_bike.value;
document.hondachain.item_name.value = document.hondachain.hondachainproduct.value + bikevalue;
for (var bi=0;bi<bike.length;bi++)
  {
  if (bike[bi].model == bikevalue)
    {
    document.hondachain.amount.value = bike[bi].price;
    break;
    }
  }
}

Last edited by c010depunkk; Nov 13th, 2007 at 05:37. Reason: please use [HTML] tags when displaying HTML code
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
New blogger, need help with altering template etc. munkimatt Starting Out 13 Nov 22nd, 2007 15:30
Rep Altering Power VanessaJW Webforumz Cafe 24 May 20th, 2007 18:39
Setting Form Values to Previously Entered Values masonbarge PHP Forum 6 Oct 17th, 2006 17:36
Assign string values to integer values of a session variable Andy K Classic ASP 1 Jul 13th, 2005 08:29


All times are GMT. The time now is 19:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42