473,597 Members | 2,149 Online
Bytes | Software Development & Data Engineering Community
+ 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 1890
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.javas cript 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.javas cript:
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.10 9.133.242> - "Evertjan."
<ex************ **@interxnl.net > writes:
:>
:>rob c wrote on 18 apr 2006 in comp.lang.javas cript:
:>
:>> 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_nam e.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
2029
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 visitor's browser is IE I would like the radiobutton with value="Internet Explorer" to be checked by default.
1
4317
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. I also placed two buttons on the form. One submits the form to redirect to the Crystal Web Viewer (genCREGReports.ASP). The other one executes VB code in a vbs document that spawns some more code to run a stored procedure with the values from...
4
11027
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 to: if one is clicked, its corresponding information will become available on another document, if it's not clicked no information will be provided. If multiple buttons are clicked their information will available on the same document. I'm not...
3
2402
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 get the group names selected value, I couldn't find any properties/methods on that object. In fact the object didn't exist for me. Is this correct? When playing with Radio buttons, do you still have to enumerate through all of them to find...
6
1395
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 different value will appear on the 'total' box down the bottom.. I can figure out how to write a scipt and have textboxes add up to a total.. And I can do it with dropdown menus, like this..
1
2550
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 text box and two radio buttons. The text box has the TabStop = True, and both radio buttons have TabStop = False. The radio buttons are set to false so that a Tab (or captured Enter) may tab to the next control. The appropriate radio button is...
3
18579
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 toolbox called an Option Group. It could contain any number of radio buttons (which Access called Option Buttons), each of which had a "value" property. The Option Group as a whole had a property equal to the value of the selected radio button. Thus...
1
3493
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 have html corrosponding radio button 6 months 1 year
6
2504
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 a user can make forms. After filling in basic details like Title, Author, Description, the user can add multiple input fields of different types. This is done in the form of a table, with each row acting for a single input, i.e. input1, input2,...
0
7969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8272
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6688
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3886
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3927
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2404
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 we have to send another system

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.