473,668 Members | 2,449 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Chained Selects and dynamic text fields

17 New Member
Hello

I have used chained selects to populate two selects. When the user chooses from first select, he is presented with the populated data for the 2nd select. The result is a list of numbers. The number varies with the choice made in the first select.

Here is the config.js

Expand|Select|Wrap|Line Numbers
  1. var hide_empty_list=true;
  2.  
  3. addListGroup("registration", "category");
  4.  
  5. addList("category", "Select a category", "", "dummy-maker");
  6. addList("category", "OMEA Member", "OMEA Member", "OMEA Member");
  7. addList("category", "OCMEA Member", "OCMEA Member", "OCMEA Member");
  8. addList("category", "Saturday Only", "Saturday Only", "Saturday Only");
  9. addList("category", "Non Member", "Non Member", "Non Member");
  10.  
  11.  
  12. addList("OMEA Member", "0", "0", "0");
  13. addList("OMEA Member", "1", "1", "1");
  14. addList("OMEA Member", "2", "2", "2");
  15. addList("OMEA Member", "3", "3", "3");
  16.  
  17.  
  18. addList("OCMEA Member", "0", "", "0");
  19. addList("OCMEA Member", "1", "", "1");
  20.  
  21.  
  22. addList("Saturday Only", "0", "", "0");
  23. addList("Saturday Only", "1", "", "1");
  24. addList("Saturday Only", "2", "", "2");
  25. addList("Saturday Only", "3", "", "3");
  26.  
  27. addList("Non Member", "0", "", "0");
  28.  
  29.  
[HTML]
<html>

<head>
<title>Chaine d Selects</title>
<script language="javas cript" src="chainedsel ects.js"
<script language="javas cript" src="config.js" >
</script>
</head>

<body onLoad="initLis tGroup('registr ation', document.forms[0].category, document.forms[0].family)">
<h2>&nbsp;</h2>

<table align="center" cellpadding="0" cellspacing="0" border="0" width="90%"><tr ><td>

<form>
<table width="490" align="center"> <tr>
<td width="87">Cate gory&nbsp;</td>
<td width="391"> <label>
<div align="left">
<select name="category" id="category">
</select>
</div>
</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="left">
<select name="family" style="width:16 0px;" id="family">
</select>
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>

</body>

</html>

[/HTML]
I want to MERGE this with a technique where the choice of numbers made in a select presents them with text field boxes equal to the number selected. Here is the code for that

[HTML]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<SCRIPT language="JavaS cript">
function ShowReg(op) {
document.getEle mentById('1').s tyle.display='n one';
document.getEle mentById('2').s tyle.display='n one';
document.getEle mentById('3').s tyle.display='n one';

if (op == 1) {
document.getEle mentById('1').s tyle.display="b lock";
}
if (op == 2) {
document.getEle mentById('2').s tyle.display="b lock";
}
if (op == 3) {
document.getEle mentById('3').s tyle.display="b lock";
}
}

</SCRIPT>


<title>Untitl ed Document</title>
</head>

<body>
<select id="family" onChange="ShowR eg(this.selecte dIndex)">
<option value='0'>0
<option value="1">1
<option value="2">2
<option value="3">3
</select>
<br>
<div id="1" style="display: none">
Family Member 1 <input type="text" id="family1" value="">
</div>
<div id="2" style="display: none">
Family Member 1 <input type="text" id="family1" value=""><br>
Family Member 2 <input type="text" id="family2" value="">
</div>
<div id="3" style="display: none">
Family Member 1 <input type="text" id="family1" value=""><br>
Family Member 2 <input type="text" id="family2" value=""><br>
Family Member 3 <input type="text" id="family3" value=""><br>
</div>

</body>
</html>
[/HTML]

Any help would be appreciated...t hanks!

Greg
Sep 5 '07 #1
7 3474
dmjpro
2,476 Top Contributor
Actually your Post is so Big that's why it is not kept in one Post.
Please break your Post into two Pieces.

Kind regards,
Dmjpro.
Sep 5 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Actually your Post is so Big that's why it is not kept in one Post.
Please break your Post into two Pieces.
The code tags were all mixed up. I've fixed it now.
Sep 5 '07 #3
dmjpro
2,476 Top Contributor
What is addList?

Kind regards,
Dmjpro.
Sep 5 '07 #4
gregincolumbus
17 New Member
What is addList?

Kind regards,
Dmjpro.
Sorry about the large post..still working on learning all of this!!


"Add list" is part of the chained selects call. I didn't attach the chained selects js file since it is huge and I assumed others would already be familiar and have access to it (and it works fine) When somebody makes a selection from the first select, it uses addlist to build the contents of the 2nd select.


Greg
Sep 5 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
To each select, add an onchange which calls showReg with its value (this.value).
Sep 5 '07 #6
gregincolumbus
17 New Member
Thanks for the help....I don't think I asked my question correctly.


This is what I am attempting to do. Ambitious job for a newbie I guess! It has 4 functions to perform:

1. Indicate the Category they need
2. Dynamically alter select2 to control how many items they may choose based upon select 1 choice
3. Dynamically add text fields that equal the number chosen from select2
4. Sum the values from select1 and select2 to obtain a grand total


Select1

Select a Category, Value = 0
OMEA Member, Value = 85
OCMEA Member, Value = 25
Saturday Only, Value = 45
Non Member, Value = 200


Select 2 (variable based on Select 1)

If Select 1 = OMEA Member
Select 2 options = 0, 1, 2, 3

If Select 1 = OCMEA Member
Select 2 options = 0, 1

If Select 1 = Saturday Only
Select 2 options = 0, 1, 2, 3

If Select 1 = Non Member
Select 2 options = 0


Text Input fields (these appear only when the user selects an option from Select2 that contains choices other than 0)

If Select 2 = 0
Do nothing

If Select 2 = 1
Value = 40
Dynamically adds one text input field, label = "Family 1" so the user can enter the family member's name

If Select 2 = 2
Value = 80
Add one text input field, label = "Family 1"
Add one text input field, label = "Family 2"

If Select 2 = 3
Value = 120
Add one text input field, label = "Family 1"
Add one text input field, label = "Family 2"
Add one text input field, label = "Family 3"


Sum of Choices
Adds Value from Select 1 to the Value from Select 2 to create a sum of both numbers.

Any suggestions are grealy appreciated!

Thanks!
Greg
Sep 5 '07 #7
pbmods
5,821 Recognized Expert Expert
Heya, Greg.

Let's focus on one select at a time.

For the first one, is your code working properly? What is it doing that you don't want it to do? What is it *not* doing that you want it to do?
Sep 5 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
17657
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
1
3329
by: Richard Hollenbeck | last post by:
Hello Newsgroup. You have all been very helpful in the past and I thank you. I try to ask relevant questions so that they don't just benefit me, but also benefit the group. I'm currently overwhelmed by useless examples across the web on how to make "dynamic crosstab reports" without myself having a basic understanding about how to retrieve and assign recordsources, etc., from fields in a query to fields in the report. I see all these...
0
1628
by: Pat Sagaser via .NET 247 | last post by:
I'm using a repeater with a dynamic template. I don't know the fields to display (or how many) until runtime. I have everything working except for linking Button events to the repeaters ItemCommand (see below). I've found plenty of examples for doing it using <ItemTemplate> in the aspx file, but I'm stumped when it comes to doing it dynamically at run time. /////////////////////////// .apsx file: <%@ Page language="c#"...
3
13741
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should always confirm a delete action. There is also a consensus that the best way to do this is a template...
3
18700
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however, working with complex reports is tricky Assumption: Reader of this article have basic knowledge of creating data reports. Creating a Parent-Child Command and create a DataReport Suppose we have a database called company with two tables ...
0
3378
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options within options. I have everything being dynamically named from the previously dynamically named element. (I hope this makes sense.) I am not able to retrieve any of the dynamically created values. I can view them on the source page but can't pull them...
1
4652
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on. and by pressing Remove button the selecetd row will be removed. I used viewstate to keep my value for postback, I want by changing selectedvalue of...
0
3493
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on. and by...
10
5292
by: ndeeley | last post by:
Hi there, Does anyone know of a decent chained selects script in CF? I'd like one that can still accept query values from the database. I found an excellent script on EasyCFM but because it uses a form I can't get it to work with my existing form on the page - clicking the dropdown executes the onSubmit action of my form and it errors out. <!--- store the selected Main_Group variable variable after the first select boxes submits itself...
0
8459
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
8371
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
8790
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
8652
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
7391
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...
1
6206
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
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2782
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
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.