473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

dynamic form

3
I am trying to build a form with many options depending on each other.

I purchased a script called dynamic list options with which I create arrays of options that populate select boxes like this:

<select name="productSwags" onChange="PopulateOptions(this, 'productFabric');">

I can also create arrays like this:

var Array4 = new Array(PleaseSelect,'[ArrayFabric1]Single Swag','[ArrayFabric2]Two Swags')

This way I can populate each select box depending on the option selected and have numerous options depending on each other.

My question now is: I want to be able to populate more than one select box at once. I can do this:

<select name="productSwags" onChange="PopulateOptions(this, 'productFabric');PopulateOptions(this, 'productTrim')">

but doing so will populate both select boxes with the same options. What I am trying to do is populate each select box with a its own set of options.

I want to set up the arrays in a certain way that each populateOptions will
only put in the options that belong to it.

Can somebody help me do this?

This is the page I am working on so you can see what I mean:

Customize your own swag valance

Thank you

Judy
Dec 10 '08 #1
5 1448
acoder
16,027 Expert Mod 8TB
If you use the id, you can refer to the other select boxes to populate them too, e.g. document.getElementById(id) would give you a reference to the element.
Dec 10 '08 #2
judyw
3
Can you please explain me where to put this in with my example.

Sorry I am not very good in javascript so I don't know how to do it without an example and then I can copy and paste it on the other places.

Thanks

Judy
Dec 10 '08 #3
acoder
16,027 Expert Mod 8TB
You say you can do this:
Expand|Select|Wrap|Line Numbers
  1. <select name="productSwags" onChange="PopulateOptions(this, 'productFabric');PopulateOptions(this, 'productTrim')">
but it populates both with the same options. Having had a look at the code for PopulateOptions, it seems that the code is a bit inflexible, but we can work around that.

You need to pass a reference to the drop-down list you want to populate from, so use document.getElementById("productSwags") to refer to the "productSwags" drop-down, but only after giving it an id:
Expand|Select|Wrap|Line Numbers
  1. <select name="productSwags" id="productSwags">
Dec 11 '08 #4
judyw
3
This is where the populate options pulls the options from:

Expand|Select|Wrap|Line Numbers
  1. var Array4 = new Array(PleaseSelect,'[ArrayFabric1]Single Swag','[ArrayFabric2]Two Swags')
The populate options only specifies which select box to put the list in. If I would put in ArrayTrim1 in the above brackets both productFabric and productTrim will get populated with the trim options(or whatever options I put in.)

So how can I add ArrayFabric1 and ArrayTrim1 to the above code?
Dec 11 '08 #5
acoder
16,027 Expert Mod 8TB
The way PopulateOptions works is that it takes the drop-down element and gets the array name from the selected, so you can only have one array at a time which is quite inflexible. It would have made more sense to keep things more flexible. You'll either have to change the function code or use something else.
Dec 12 '08 #6

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

Similar topics

0
by: Pat Patterson | last post by:
I'm having serious issues with a page I'm developing. I just need some simple help, and was hoping someone might be able to help me out in here. I have a form, that consists of 3 pages of...
1
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...
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list...
3
by: CAD Fiend | last post by:
Hello, Well, after an initial review of my database by my client, they have completely changed their minds about how they want their form. As a result, I'm having to re-think the whole process....
1
by: Will | last post by:
Hi all. I'm learning VB.Net and am developing a WinForms app. I'm trying to make an app that I will use to scan in one or more than on image. I want to use a tabbed interface to hold each image....
6
by: MikeY | last post by:
Hi Everyone, Does anyone know where I can get my hands on a sample with source code of a simple dynamic button control in C# Windows form. I am looking for a sample that uses a class library...
3
by: Tyler Carver | last post by:
I am trying to use some dynamic controls that are built and then added to tables. The problem that I am having is the timing of when I can populate the controls and have the state remain after a...
7
by: Abraham Luna | last post by:
how do i stop the dynamic validators from breaking explorer if i use a dynamic validator and move to a different control it breaks explorer and i can type in the page when i'm not supposed to....
8
by: George Meng | last post by:
I got a tough question: The backgroud for this question is: I want to design an application works like a engine. After release, we can still customize a form by adding a button, and source code...
2
by: deejayquai | last post by:
Hi I'm trying to produce a report based on a dynamic crosstab. Ultimately i'd like the report to actually become a sub report within a student end of year record of achievement. The dynamic...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.