473,661 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

display text field based on the selection choices

I want to display credit card fields when the user selects the option paid
membership. If user selects the option free membership, then the credit card
text field will disappear. Here's the code I did with JavaScript but didn't
work.

<SCRIPT LANGUAGE="JavaS cript">
function generateCreditT extField()
{ if (document.myfor m.membership.va lue == "1")
{ alert('free');
document.write( "");
}
else
{ alert('paid');
document.write( "<P>Credit Card: <input type="text" name="credit")</P>"); }
}
</SCRIPT>

<form name="myform">
<select name="membershi p" onchange="gener ateCreditTextFi eld()">
<option></option>
<option value="1">Free Membership</option>
<option value="2">Paid Membership</option>
</select>
</form>

please advise! Thanks!
John



Jul 19 '05 #1
1 2624
Gazing into my crystal ball I observed "John Davis"
<jr*******@hotm ail.com> writing in
news:ef******** *****@tk2msftng p13.phx.gbl:
I want to display credit card fields when the user selects the option
paid membership. If user selects the option free membership, then the
credit card text field will disappear. Here's the code I did with
JavaScript but didn't work.

<SCRIPT LANGUAGE="JavaS cript">
function generateCreditT extField()
{ if (document.myfor m.membership.va lue == "1")
{ alert('free'); document.write( ""); } else
{ alert('paid');
document.write( "<P>Credit Card: <input type="text"
name="credit")</P>"); } } </SCRIPT>

<form name="myform">
<select name="membershi p" onchange="gener ateCreditTextFi eld()">
<option></option>
<option value="1">Free Membership</option>
<option value="2">Paid Membership</option> </select> </form>

please advise! Thanks!
John


What about users without javascript?

You could always do something put the option on page one, then test for the
value of the option on the next page, and generate the credit card based on
that.

--
Adrienne Boswell
Please respond to the group so others can share
http://www.arbpen.com
Jul 19 '05 #2

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

Similar topics

1
2097
by: stewart | last post by:
I'm writing an app that requires a 3-level optionMenu display. Basically I'm showing the contents of a 3-dimensional matrix. You choose the first level in the first optionMenu, the 2nd level in the next level, and the 3rd level in the last optionMenu. Let's call them Continent,country,state. continentList = countryList = ,,] stateList = ,,],] When I open the window, all is well. I can display the following as default
7
1897
by: NotGiven | last post by:
I'd like to have several levels of field selection. For example, field one has three choices. Once you choose on form field one, several selections show in field based that ARE BASED ON your selection in field one. Field three selections are based on field two,... If you know of a good tutorial or site recommendations, I' appreciate you posting them here. Thanks.
4
4000
by: Keith | last post by:
Hello - this started out as a minor annoyance - and now is starting to bother me more and more - I'm hoping someone can help me. I would like to have a combobox display - NOT initially be blank - but contain a value. However the value is just for user reference - not really one of the combobox choices. For example intially the combobox should equal the word Select - and the item values can be say 'one', 'two', and 'three'.
2
7989
by: Erwin Moller | last post by:
Hi group, I have this obscure problem that really needs to be fixed, but I am out of ideas. Because the original script is very big, I'll try to summarize its functionality. Setup: - many form-elements that will 'activate' a part of the form based on the selection made.
12
1870
by: dbuchanan | last post by:
I am designing a table to contain a field to stores a value that must indicate none, one, or many choices. The form will have a group box with checkboxes (multi-choice) You see the records in this table contain partially pre-configured records. The records serve as "master" data that will later be inserted into a data table. The master data is set up by an adminsitrator. The administrator indicates for each record the none, one or many...
1
9024
by: RonY | last post by:
I have a dropdown which calls SetTimePeriod method on change the selection. In the JS function, I reset the field style.display based on what the selection is. This works fine with IE but not working with Firefox browser. The firefox browser has problem to display a field after its style.display is reset. At the end of the JS function, I printed out the fields style.display value. They are set correctly. How to resovle this? My JS is : ...
1
3636
by: peasedm | last post by:
Okay this one has me stumped. I have a table called Review_Statements with the following columns: statementid type statement1 statement2 statement3 I have a form called SR_Review with an unbound combo box control
9
3849
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of "task_id" and the label of "task_name". In the second form field, I would like the default value to be determined by the selection made in the first field. Based on the selection of the first form field, I would like the default value of the...
10
7377
by: dkyadav80 | last post by:
<html> /// here what shoud be java script for: ->when script run then not display all input text field only display selection field. ->when user select other value for institute only this field display not display degree text field ->when user select other value in the selection field for degree then text field display and wise versa //// <bodly> <table>
0
8428
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
8341
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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...
1
8542
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
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...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4177
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
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2760
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.