why does this not worl

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

why does this not worl

Post by shiznatix »

onclick="javascript: document.thisform40.item_name.value = document.thisform40.itemName1.value.' '.document.thisform40.itemName2.value;"

why does that not work for this form

Code: Select all

<form name=&quote;thisform40&quote; action=&quote;https://www.paypal.com/cgi-bin/webscr&quote; method=&quote;post&quote; target=&quote;paypal&quote;>
Rx7club.com Hoodie: 
<select name=&quote;itemName1&quote;>
	<option value=&quote;itemName1&quote; selected>Choose Size/Color:</option>
    <option value=&quote;S Navy Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Small Navy Rx7Club Hoodie</option>
    <option value=&quote;M Navy Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Medium Navy Rx7Club Hoodie</option>
    <option value=&quote;L Navy Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Large Navy Rx7Club Hoodie</option>
    <option value=&quote;XL Navy Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Xtra Large Navy Rx7Club Hoodie</option>
    <option value=&quote;XXL Navy Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>XtraXtra Large Navy Rx7Club Hoodie</option>
    <option value=&quote;S Black Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Small Black Rx7Club Hoodie</option>
    <option value=&quote;M Black Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Medium Black Rx7Club Hoodie</option>
    <option value=&quote;L Black Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Large Black Rx7Club Hoodie</option>
    <option value=&quote;XL Black Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Xtra Large Black Rx7Club Hoodie</option>
    <option value=&quote;XXL Black Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>XtraXtra Large Black Rx7Club Hoodie</option>
	<option value=&quote;S White Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Small White Rx7Club Hoodie</option>
    <option value=&quote;M White Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Medium White Rx7Club Hoodie</option>
    <option value=&quote;L White Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Large White Rx7Club Hoodie</option>
    <option value=&quote;XL White Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Xtra Large White Rx7Club Hoodie</option>
    <option value=&quote;XXL White Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>XtraXtra Large White Rx7Club Hoodie</option>
	<option value=&quote;S Steel Grey Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Small Steel Grey Rx7Club Hoodie</option>
    <option value=&quote;M Steel Grey Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Medium Steel Grey Rx7Club Hoodie</option>
    <option value=&quote;L Steel Grey Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Large Steel Grey Rx7Club Hoodie</option>
    <option value=&quote;XL Steel Grey Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>Xtra Large Steel Grey Rx7Club Hoodie</option>
    <option value=&quote;XXL Steel Grey Rx7Club Hoodie&quote; name=&quote;itemName1&quote;>XtraXtra Large Steel Grey Rx7Club Hoodie</option>
</select>
<br>One of Any Rx7club.com T-Shirt:
		<select name=&quote;itemName2&quote;>
	<option value=&quote;itemName2&quote; selected>Choose Size/Color/Design #:</option>
    <option value=&quote;S Black Rx7Club T-shirt Design #1&quote; name=&quote;itemName2&quote;>Small Black Rx7Club T-shirt Design #1</option>
    <option value=&quote;M Black Rx7Club T-shirt Design #1&quote; name=&quote;itemName2&quote;>Medium Black Rx7Club T-shirt Design #1</option>
    <option value=&quote;L Black Rx7Club T-shirt Design #1&quote; name=&quote;itemName2&quote;>Large Black Rx7Club T-shirt Design #1</option>
    <option value=&quote;XL Black Rx7Club T-shirt Design #1&quote; name=&quote;itemName2&quote;>Xtra Large Black Rx7Club T-shirt Design #1</option>
    <option value=&quote;XXL Black Rx7Club T-shirt Design #1&quote; name=&quote;itemName2&quote;>XtraXtra Large Black Rx7Club T-shirt Design #1</option>
</select>
<input type=&quote;hidden&quote; name=&quote;item_name&quote;>
<input name=&quote;price&quote; value=&quote;100.00&quote; type=&quote;hidden&quote;>
<input name=&quote;amount&quote; value=&quote;100.00&quote; type=&quote;hidden&quote;>
<input name=&quote;add&quote; value=&quote;1&quote; type=&quote;hidden&quote;>
<input name=&quote;cmd&quote; value=&quote;_cart&quote; type=&quote;hidden&quote;>
<input name=&quote;business&quote; value=&quote;Mark87G@comcast.net&quote; type=&quote;hidden&quote;>
<input name=&quote;page_style&quote; value=&quote;PayPal&quote; type=&quote;hidden&quote;>
<input name=&quote;currency_code&quote; value=&quote;USD&quote; type=&quote;hidden&quote;>
<input name=&quote;submit&quote; type=&quote;image&quote; src=&quote;../img/addtocart.jpg&quote; width=&quote;160&quote; height=&quote;53&quote; onClick='document.thisform40.item_name.value' = 'document.thisform40.itemName1.value.' '.document.thisform40.itemName2.value;'>
</form>
i did not write this form so dont make fun at some of its stuff
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Concat with a + not a .

Code: Select all

onclick=&quote;javascript: document.thisform40.item_name.value = document.thisform40.itemName1.value + document.thisform40.itemName2.value&quote;;

I would put this code into a function and call the js function vs having the js code in the link.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

You changed your post...

you have a parse error with single and double quotes in you on click.

See previous comment about calling a function instead...

Code: Select all

<input name=&quote;submit&quote; type=&quote;image&quote; src=&quote;../img/addtocart.jpg&quote; width=&quote;160&quote; height=&quote;53&quote; onClick=&quote;callAFunction();&quote;>
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

many thanks. you people are too fast for me i tell you what
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

shiznatix wrote:you are too fast for me i tell you what
Once again... If I got a $1 for everytime I heard that... :lol: :lol: :lol:
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You would have $2 :lol:
Post Reply