473,473 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

forms, radio buttons and setting values

Hi

I'm not sure if this is the right place to ask for help on forms and radio
buttons...

In the following form, I'd like to set the value of 'item_name' based on which
radio button was selected.
If amount=14, then I want to set item_name='5x7 print'.
If amount=20, then I want to set item_name='5x7 print (drymounted)'.

<form target='paypal' action='https://www.paypal.com/cgi-bin/webscr'
method='post'>
<input type='hidden' name='add' value='1'>
<input type='hidden' name='cmd' value='_cart'>
<input type='hidden' name='quantity' value='1'>
<input type='hidden' name='on0' value='Image'>
<input type='hidden' name='os0' value=362_0515'>
<input type='hidden' name='item_name' value='5x7'>

<input checked type='radio' name='amount' value='14.00'>
<input type='radio' name='amount' value='20.00'>

<input type='image' src='../graphics/cart-add.gif' border='0' name='submit'>
</form>

The live form is here:
http://www.rcp.ca/webgallery/skiing/...s/362_0515.htm

Thanks
Rob C

Apr 18 '06 #1
3 1879
rob c said the following on 4/18/2006 11:04 AM:
Hi

I'm not sure if this is the right place to ask for help on forms and radio
buttons...


<URL: http://www.jibbering.com/faq/faq_not...ess.html#faBut >

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 18 '06 #2
rob c wrote on 18 apr 2006 in comp.lang.javascript:
I'm not sure if this is the right place to ask for help on forms and
radio buttons...

In the following form, I'd like to set the value of 'item_name' based
on which radio button was selected.
If amount=14, then I want to set item_name='5x7 print'.
If amount=20, then I want to set item_name='5x7 print (drymounted)'.

<form target='paypal' action='https://www.paypal.com/cgi-bin/webscr'
method='post'>
<input type='hidden' name='add' value='1'>
<input type='hidden' name='cmd' value='_cart'>
<input type='hidden' name='quantity' value='1'>
<input type='hidden' name='on0' value='Image'>
<input type='hidden' name='os0' value=362_0515'>
<input type='hidden' name='item_name' value='5x7'>

<input checked type='radio' name='amount' value='14.00'>
<input type='radio' name='amount' value='20.00'>


<form target='paypal'
action='https://www.paypal.com/cgi-bin/webscr'
method='post'
onsubmit="
this.item_name.value=
(this.amount[0].checked)
?'5x7 print'
:'5x7 print (drymounted)'">

<input type='hidden' name='item_name' value='5x7'>
<input checked type='radio' name='amount' value='14.00'> 14.00<br>
<input type='radio' name='amount' value='20.00'> 20.00<br>
...........
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 18 '06 #3
In message <Xn********************@194.109.133.242> - "Evertjan."
<ex**************@interxnl.net> writes:
:>
:>rob c wrote on 18 apr 2006 in comp.lang.javascript:
:>
:>> I'm not sure if this is the right place to ask for help on forms and
:>> radio buttons...
:>>
:>> In the following form, I'd like to set the value of 'item_name' based
:>> on which radio button was selected.
:>> If amount=14, then I want to set item_name='5x7 print'.
:>> If amount=20, then I want to set item_name='5x7 print (drymounted)'.
:>>
:>> <form target='paypal' action='https://www.paypal.com/cgi-bin/webscr'
:>> method='post'>
:>> <input type='hidden' name='add' value='1'>
:>> <input type='hidden' name='cmd' value='_cart'>
:>> <input type='hidden' name='quantity' value='1'>
:>> <input type='hidden' name='on0' value='Image'>
:>> <input type='hidden' name='os0' value=362_0515'>
:>> <input type='hidden' name='item_name' value='5x7'>
:>>
:>> <input checked type='radio' name='amount' value='14.00'>
:>> <input type='radio' name='amount' value='20.00'>
:>>
:>>
:>
:><form target='paypal'
:>action='https://www.paypal.com/cgi-bin/webscr'
:>method='post'
:>onsubmit="
:>this.item_name.value=
:>(this.amount[0].checked)
:>?'5x7 print'
:>:'5x7 print (drymounted)'">
:>
:><input type='hidden' name='item_name' value='5x7'>
:><input checked type='radio' name='amount' value='14.00'> 14.00<br>
:><input type='radio' name='amount' value='20.00'> 20.00<br>
:>...........
:>
:>
:>--
:>Evertjan.
:>The Netherlands.
:>(Please change the x'es to dots in my emailaddress)

Thanks for the help!!!

I used the <form ... onsubmit...> method with a slight change to my original
idea.

I decided to leave the item_name variable unchanged after discovering that
PayPal has a second set of 'option values' (on1 and os1). So I added:
<input type='hidden' name='on1' value='Dry Mounted'>
<input type='hidden' name='os1' value='not set yet'>

And the <form> line looks like this:
<form target='paypal'
action='https://www.paypal.com/cgi-bin/webscr'
method='post'
onsubmit='this.os1.value=(this.amount[0].checked)?"No":"Yes"'>

The results from PayPal show as "Dry Mounted: Yes" or "No". If "not set yet"
appears then there is a problem, maybe I should change that to something like
"there's been an error - please let me know about it".

Thanks again!

Rob
www.rcp.ca

Apr 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hamster | last post by:
How can I pass user's browser, OS and resolution information to the form element? I need to make radiobuttons to be checked by default according to the user's information. For example, if...
1
by: Jim Quast | last post by:
I have an ASP page and a CREGReports002.vbs file coded to export data to excel. I do this by building variables in a stored procedure. The ASP page has text boxes, list boxes, and radio buttons. ...
4
by: Jared | last post by:
Radio Button or Check Box and Event Procedures I need to insert either radio buttons or check boxes onto my form. I'm not sure which to use, or if there are other options. I am using the buttons...
3
by: Flip | last post by:
In setting up a radio button group last night, I added two radio buttons, gave each of them their respective name and gave them both the same group name. So far so good. But then when I tried to...
6
by: Kissingfish | last post by:
Hi there.. I'm trying to configure a quote form for my website.. I want to have different fields, for example radio buttons, check boxes and drop-down menus, and depending on what you select, a...
1
by: Shane | last post by:
I think that I found a bug in the Radio Button, and I wanted to give everybody a "Heads Up". I spent three days doing trial and error until I found a work around. I created a user control with a...
3
by: teddysnips | last post by:
Back in the dim mists of antiquity I used to program in VBA for Microsoft Access (hey, don't knock it - very useful tool for the right application). This had a really handy control in the...
1
by: Lazairus | last post by:
simply how do you set enums in a database using coorsoponding radio button from a html form now i have a table client_membership in mysql with the membership_type enum('six','one') i...
6
by: Zetten | last post by:
This is going to be a long one, but hopefully that will make it easier to understand. I know I don't like posts with too little detail when I'm searching for help. I am creating a form with which...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.