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="productSw ags" onChange="Popul ateOptions(this , 'productFabric' );">
I can also create arrays like this:
var Array4 = new Array(PleaseSel ect,'[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="productSw ags" onChange="Popul ateOptions(this , 'productFabric' );PopulateOptio ns(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
5 1456 acoder 16,027
Recognized Expert Moderator MVP
If you use the id, you can refer to the other select boxes to populate them too, e.g. document.getEle mentById(id) would give you a reference to the element.
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
acoder 16,027
Recognized Expert Moderator MVP
You say you can do this: - <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.getEle mentById("produ ctSwags") to refer to the "productSwa gs" drop-down, but only after giving it an id: - <select name="productSwags" id="productSwags">
This is where the populate options pulls the options from: - 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?
acoder 16,027
Recognized Expert Moderator MVP
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 fields. I'd like to create
a page in which all of this is stored as you move along as hidden
variables, until the end, when the user submits. I can't figure out
one thing: I have dynamic form elements (dropdowns), that I'd like to
use instead of...
|
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
|
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 boxes
do not necessarily need to have a selection made to be used in the
dynamic query.
In essence the form can have selections made in all or none of its list
boxes to form the dynamic query
I am looking to get some feedback in reference to...
|
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.
My Current Form (6 tabs):
- Owner, Property, Title, Docs, Queries, & Reports
- User is able to see (while navigating through the tabs) above in the
form : Owner Name, Address, Parcel, and SSN
|
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. Here's
the code I'm using for testing purposes. I've got the code in the
form's load event, but I think I'd have the same problems no matter
where the code existed. Right now, the form has an empty tab control,
everthing else is dynamic.
<code>
| |
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 that sets the properties send/passed from the main
windows form. I'm having problems with the class library, the button control
collection and my referencing it ie this.Control.Add(aControl);.
Any and all help is appreciated. Thanks in advance.
|
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 postback. The
main question would be this:
Why does this work for maintaining state after a postback for dynamic
controls:
myText = new Label();
myText.ID = "myText";
|
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. thank you.
|
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 for the button. (This is done by the form itself, not by using VS.Net)
(button and source code should be a record in database, these information
should be retrieve from database when the form shows up)
What I want is:
|
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 sub-report will capture
what grades the student has achieved in a list of different subjects
and the reason I need it to be dynamic is that students take different
subjects.
Basically I've been trying to doctor the KB article on dynamic
|
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...
| |
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,...
|
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |