473,387 Members | 1,621 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,387 software developers and data experts.

Passing values between 2 drop down forms on the same page

I have 2 forms on a page. I need to take one of the values from a drop down menu on the first form then pass this value to the second form on the same page.


Specifically I have 2 triple Drop Down (DD) menus.

Expand|Select|Wrap|Line Numbers
  1.          ======DD2 =========DD3
  2.          |
  3. DD1      |
  4.          | 
  5.          ======DD4 ========DD5
I have
DD1, DD2 and DD3 on one form
and
DD1, DD4 and DD5 on the other form

I was getting too messed up merging them so I broke them into 2 forms. Each is working but I don't want the user to have to select DD1 twice on the same page.

Thanks.
Nov 30 '11 #1
9 2243
Dormilich
8,658 Expert Mod 8TB
the problem is that you can’t have one dropdown in two forms. what you may do is on selection of DD1 in one form updating a hidden field in the second form.
Nov 30 '11 #2
Yes, I had to give DD1 different names. If I am using basically the same code, how would I pass the information to the hidden field? Thanks.
Dec 1 '11 #3
Dormilich
8,658 Expert Mod 8TB
you would have to use JavaScript for that. in the change event of the dropdown, just pass the value to the hidden field.
Expand|Select|Wrap|Line Numbers
  1. // the dropdown
  2. var sel = document.myform1.dd1;
  3. // the hidden field
  4. var hid = document.myform2.dd1;
  5.  
  6. function pass_value()
  7. {
  8.     document.myform2.dd1.value = this.value;
  9. }
  10. sel.addEventListener("change", pass_value, true);
Dec 1 '11 #4
I couldn't get this to work. But I think I have a simple solution...in JavaScript, can I set different variables to the same element in js within the same form? For instance: can I set:
Expand|Select|Wrap|Line Numbers
  1. aMenu3=document.formTripleMenu.menuTopics 
  2. //and
  3. aMenu6=document.formTripleMenu.menuTopics 
  4.  
Dec 2 '11 #5
Dormilich
8,658 Expert Mod 8TB
and what does that help you?
Dec 2 '11 #6
I thought then that I could merge the code from the 2 forms, then have the 4 other DDMs as variables, with one common DDM1. The key would be if I could have 2 variables for the 1st DDM. Does this make sense?
Dec 2 '11 #7
omerbutt
638 512MB
if you need to make a set of collections from all the drop downs into one single DD then why dont you keep collecting the selected values and then populate a DD on runtime with javascript , i hope i am getting you right.
regards,
Omer Aslam
Dec 2 '11 #8
@omerbutt
No, I need 4 distinct drop downs, driven from one common DD. Think Regions, County, Towns as one set, an the other as Regions, Property Types and Property sub-Types. The Region DD is the same.

I have the code for the two sets now in two separate forms and js files because I was going insane. So now they are working. The logic is the same. So now I want to get rid of the need to ask for Region twice. Dormilich suggested I use the hidden input, but I couldn't get that working...so I then thought I would just merge the 2 forms AND merge the 2 js code since I kept a different set of variables for each js page. The only thing I need is to see if I can use the same parameters from Regions to drive 2 different branches.

Obviously, this is not working and I wanted to know if this was the problem :-(
Dec 2 '11 #9
Dormilich
8,658 Expert Mod 8TB
the core question is, what of these DDs you need to submit in the end. if you only need to submit Town or Property sub-type it doesn’t matter where DD1 is.

according to your description it seem that you have something like a combo box (select from the first, then the next is auto populated (by AJAX) depending on the selected value and so on). in this case you just need to trigger the auto-populating for each of the next two DDs.
Dec 2 '11 #10

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

Similar topics

2
by: Fabrizio | last post by:
HI, i need to pass a value from a Web Page to another in ASP.NET, eg. i want to keep the user name from a login page and diplay to next page . What should I use? Thanks, fabrizio
4
by: rick | last post by:
Does anyone having a working example of passing values between web forms pages? I tried the example in the ms- help but I can't get by the following: To read property values from the source...
5
by: cgia | last post by:
I am porting an old client/server application to asp.net. I used to retrieve data into local tables (Paradox table-files on the client's disk) and work on them before saving them back to the...
1
by: Bruno Alexandre | last post by:
Hi guys, How can I pass session/application values from a web page (ASP or ASP.NET) that is on a host company, into my cliente application? So I can hide menus based on access permisions once...
0
by: Rico Singleton | last post by:
I currently have an asp page that contains a simple form and a few hidden fields. One of those hidden fields retrieves a value passed in when a link is clicked that passes a value (i.e...
4
by: RipperT | last post by:
College newbie here (Instructor MIA). I have instructions to pass variable values from one web page to another like this (VS2005): 1. Declare and create the properties on the first page (source...
9
by: igotyourdotnet | last post by:
In my web app i have a drop down on my pages. I pass the selected item in the drop down from page to page. The issue is when I go back to page one I see the data in there twice. How can I have the...
2
by: robkiolbasa | last post by:
Hello, I am stumped on how to set a form field value to a value in a different form. It seems like something that should be pretty easy. Basic example below: <form name = "form1" action =...
3
by: Montu76 | last post by:
Hi All, I want to pass values from .apsx page(textbox value) to .ascx page. Any sort of help will be appreciated. Regards
4
by: ghjk | last post by:
I'm developing web application using php and my sql. And use Jpgraph for graph creation. Because of the probelm to edit jpgraph php file i want to pass values to it. Ex. main.php have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...
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...

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.