AJAX two drop down lists
I found a lot tutorials out there showing you how to make one drop down list populates another one but most of them either render the second ddl html in javascript (dealing with DOM crap!) or use third-party controls such as ATLAS. Then I decided to come up with my own solution for the problem. What I did was wrap the regular ASP.NET drop down list with two strings and strip off the rendered html that is returned to the Ajax object. This provides me a lot of flexibility: One=> I can use the regular ASP.NET control not having to dealing with DOM objects in JavaScript. Two=> I can use the same technique to use any ASP.NET controls with Ajax.
I posted this tutorial at www.KYNOU.com
I hope you guys like it!
I found a lot tutorials out there showing you how to make one drop down list populates another one but most of them either render the second ddl html in javascript (dealing with DOM crap!) or use third-party controls such as ATLAS. Then I decided to come up with my own solution for the problem. What I did was wrap the regular ASP.NET drop down list with two strings and strip off the rendered html that is returned to the Ajax object. This provides me a lot of flexibility: One=> I can use the regular ASP.NET control not having to dealing with DOM objects in JavaScript. Two=> I can use the same technique to use any ASP.NET controls with Ajax.
I posted this tutorial at www.KYNOU.com
I hope you guys like it!
Similar Messages
-
How can I use two drop down lists for one time value?
I want to enter the length of time that someone does an activity in hours and minutes using two drop down lists, then enter them as a single time value (H:i:s) in Mysql.
I've used the basic drop down lists, and a few different variations of the following with no success (seconds is a hidden field with a value of "00"):
GetSQLValueString(strftime('%H:%i:%s', strtotime($_POST["sleeptimemin"]." ".$_POST["sleeptimehr"]." ".$_POST["seconds"])), "date"),
This returns 00:00:16, no matter what is selected on the drop down list.
Any help would be appreciated.MySQL stores times in human-understandable format, using the 24-hour clock.
GetSQLValueString($_POST['sleeptimehr'] . ':' . $_POST['sleeptimemin'] . ':00', "date"), -
Linking two drop down list together
I have two drop downs list and I need to link them together for the user to only answer one of them and it won't allow an answer in the other or vice versa. How can I set that up?
If answer drop down list A then can't answer drop down list B
else
if drop down list B is answered then drop down list A can't be answered.The attached contains two drop-down lists - apples and oranges. Each drop-down list has a default list item value of " ", thus the default index is 0 (zero). If you select a value other than default, the other drop-down list has it's access protected and the list item reset to 0 (zero). Conversely, if you select the default value, the other drop-down list becomes open or accessible.
// form1.page1.apples::exit - (JavaScript, client)
if (form1.page1.apples.selectedIndex != 0) {
form1.page1.oranges.access = "protected";
form1.page1.oranges.selectedIndex = 0;
else {
form1.page1.oranges.access = "open";
// form1.page1.oranges::exit - (JavaScript, client)
if (form1.page1.oranges.selectedIndex != 0) {
form1.page1.apples.access = "protected";
form1.page1.apples.selectedIndex = 0;
else {
form1.page1.apples.access = "open";
Steve -
Dynamically manipulating two drop down lists
Dear All,
I am working with one form which has two drop down lists. Name of first drop down is State Name which is having all state names from database.Another drop down name is City Name and the values has to be populated from data base according to the first drop down value.
Now I am able to generate first drop down from database . But I am unable to manipulate second drop down.
Please anybody can help me to resolve this problem. Your suggestions are appreciated.
ThanksDear All,
I am working with one form which has two drop down lists. Name of first drop down is State Name which is having all state names from database.Another drop down name is City Name and the values has to be populated from data base according to the first drop down value.
Now I am able to generate first drop down from database . But I am unable to manipulate second drop down.
Please anybody can help me to resolve this problem. Your suggestions are appreciated.
Thanks -
Hi
I have two drop down lists.
One called P2_PRODUCT_GROUP which has a LOV.
Also another called P2_PRODUCTS which has another LOV.
I want P2_PRODUCTS to be filtered based on the selection I make in P2_PRODUCT_GROUP.
I've used the following SQL statement for the P2_PRODUCTS LOV:
select PRODUCT d, ID r
from PRODUCT
where ID = :P2_PRODUCT_GROUP
When I run the page, it doesnt display anything in the P2_PRODUCTS drop down list at all, even after I select a PRODUCT in P2_PRODUCTS nothing shows in P2_PRODUCT_GROUP.
What am I doing wrong?
Regards
Adam
Message was edited by:
user582756Hi Adam,
that's the classical cascading lov problem. It's not necessary to do a page submit roundtrip, you can use AJAX instead.
Have a look at Carl Backstrom's AJAX example at http://htmldb.oracle.com/pls/otn/f?p=11933:37 or have a look at my generic cascading lov which is part of the ApexLib Framework http://inside-apex.blogspot.com/2006/11/generic-solution-for-depending-select.html
BTW, my solution also can handle a popup lov as a master.
Patrick
My APEX Blog: http://inside-apex.blogspot.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/ -
Dynamic drop down list with dynamic sql
Hi all,
I am facing a problem here..Please see if any one can help.
I jave a JSP page which has two drop down list boxes.
One list box is populated from the databse.
ListBox1:
values: kishan
maha
tony
assuming all those were populated from database.
ListBox2:
values: Chennai
Bangalore
Hyderabad
should come if "kishan" is selected from the first listbox.
if "maha" is selected then
Values: Delhi
Goa
Mumbai
should be populated from the databse using the where condition
got by the first selection.
Both these boxes are in same page and i do not want to transfer
this to another page..staying in the same how to accomplish this.
An onChange function of the selection list on listBox1 can be
written which gives me what value is selected. This i can get in
Java script. But how to give this value to a jsp variable which
queries the database using the selected value.
Is there any other logic i can use.
remember there is no request that is passed. both are in same page and on selection it should stay in same page populating the
second one dynamically.Bcoz what i have said is the operation in one row.. the same should happed for 5 rows in a form so.. pls send me code if possible or links related to this problem
please help.You can use Ajax ;-) or you do a server roundtrip (aka postback) i.e. the onchange event of ListBox1 submits the form and the server returns the same page with the updated ListBox2
-
How do I use one drop down list to refresh the list in another drop down?
I am using a drop down list full of years (i.e. 2008, 2009..etc). When I make my selection from this drop down list (say for instance I select 2009) I want it to update the available data in the second drop down list. I have the query statement set up within the JSP page but it needs to be a dynamic SQL statement based off the value I selected in the first drop down.
String sql = "SELECT GameId, GameDescription FROM Games WHERE Year = " + year;
The variable "year" is the value I need to figure out how to assign. Now this variable is a Java variable (attribute) and Im unsure how to get the value from the previous drop down and assign it to that. Basically I need the JavaScript value from the first drop down assigned to the Java attribute "year".
Anyone able to help me with this???
Thanks,
JedHere are my two drop down lists. As you can see I build the second list dynamically based off the value of the year. I want to be able to assign my year to the value I select in this first drop down. How do I do that?? I only want to show games for the year I select. I currently have the year hardcoded to "2009" as you see below. How can i change that to be assigned to the JavaScript value i extract from the first select box?
<select name="season">
<option value='2009' selected>2009</option>
<option value='2008'>2008</option>
</select>
<select name="gameselect">
<%
try
String year = "2009";
String connectionURL = "jdbc:mysql://localhost:3306/ElmwoodExpos";
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(connectionURL, "root", "thejedster");
String sql = "SELECT GameId, GameDescription FROM Games WHERE Year = " + year;
Statement s = con.createStatement();
s.executeQuery(sql);
ResultSet rs = s.getResultSet();
while(rs.next())
%>
<option value="1"><% out.print(rs.getString("GameDescription"));%></option>
<%
catch(Exception e)
%>
</select>
Thanks,
Jed -
Drop down list value dependant on value in another drop down list
Hi
I am not familiar with Java Script so if anyone can advise me on this I would be grateful. I am using ADobe Livecycle V8.0.
I have two drop down lists - DDL1 and DDL2.
The choices in DDL1 are "High, Medium, Low, None"
The choices in DDL2 are "Positive, Negative, None"
If "None" is selected in DDL1 I want DDL2 to display "None".
If any of the other values are selected in DDL1, then I don't want anything autofilled in DDL2.
Hope this makes sense!
Thank you.This should do the trick:
in the "change" event of DropDownList1, put this:
if (xfa.event.newText == "None"){
DropDownList2.selectedIndex = 3; // at pos. 3, you should have "None"
// otherwise change here at your convenience
else {
DropDownList2.selectedIndex = 0; // here first element empty/default
// maybe you prefer the last one
Note that generally dropdown boxes have the first or last element empty/default; this way, when you script the "else" part, you can easily reset DropDownList2. -
How do I use a drop-down list to populate a list box
I'm using livecycle 8:
I basically have a drop down list with many selections available. I want the function to be when they select from the drop-down the choice they made appears in a list box next to the drop-down box. If they choose to add additional selections from the drop-down list they will add to the list field as well. If anyone has seen one of those on-line job application sites where you have a list of qualities on the left and you can select them and they populate to a list on the right, That is basically what I want.
I'm not too familiar with adobe quite yet and if you can break the process down as much as possible I would greatly appreciate it.Here are my two drop down lists. As you can see I build the second list dynamically based off the value of the year. I want to be able to assign my year to the value I select in this first drop down. How do I do that?? I only want to show games for the year I select. I currently have the year hardcoded to "2009" as you see below. How can i change that to be assigned to the JavaScript value i extract from the first select box?
<select name="season">
<option value='2009' selected>2009</option>
<option value='2008'>2008</option>
</select>
<select name="gameselect">
<%
try
String year = "2009";
String connectionURL = "jdbc:mysql://localhost:3306/ElmwoodExpos";
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(connectionURL, "root", "thejedster");
String sql = "SELECT GameId, GameDescription FROM Games WHERE Year = " + year;
Statement s = con.createStatement();
s.executeQuery(sql);
ResultSet rs = s.getResultSet();
while(rs.next())
%>
<option value="1"><% out.print(rs.getString("GameDescription"));%></option>
<%
catch(Exception e)
%>
</select>
Thanks,
Jed -
Populating Drop down List in Excel Planning Layout
HI!
hopefully somebody can help me.
I have a simple planing function ( copy function: Version1 => Version2 ), Version2 the target version is a BEx Variable and a parameter of the copy planing function.
basicly i want to put a drop down list on a Excel Planing Layout to manipulate the BEx Variable (Version 2 - the target version). So that the user can fill the BEx Variable by selecting the version by the dropdown list.
In BW-BPS is quite simple -but unfortunately i dont know how it works in BW-IP.
Best Regards
Mike
Message was edited by:
Mike KhatibHello Mike,
First you create two Drop Down lists (Dimension Version, Read Mode Masterdata table) in your workbook. Now go to the Visual basic editor (alt+F11) and you will find the following code for each Drop Down list:
Public Sub DROPDOWN_22_LostFocus()
Dim lComboBoxName As String
Dim BEx1 As Object
On Error Resume Next
lComboBoxName = "DROPDOWN_22"
Set BEx1 = Application.Run("BExAnalyzer.xla!GetBEx")
Call BEx1.RaiseComboBoxChange(Parent.Name, lComboBoxName)
End Sub
Comment the last line and add a function to output the chosen value to a cell in the workbook
Public Sub DROPDOWN_22_LostFocus()
Dim lComboBoxName As String
Dim BEx1 As Object
Dim version As String
'Call Dropdown List
On Error Resume Next
lComboBoxName = "DROPDOWN_22"
Set BEx1 = Application.Run("BExAnalyzer.xla!GetBEx")
'Call BEx1.RaiseComboBoxChange(Parent.Name, lComboBoxName)
'get version
version = DROPDOWN_22.Text
'output chosen version to a cell in the workbook
Range("C801").FormulaR1C1 = version
End Sub
Now add a command range to your workbook (VAR_VALUE_1,1, <VERSION>). Thats it.
If you need further information dont hesitate to ask me!
Best regards
Johannes
PS: Please assign points if this information was helpful -
Create a drop down list that populates based on the selection form another drop down list.
I need to set up a drop down list that is popualated (i.e. displays a certain list of selctions in the drop down list) based on the choise the form user selects in an adjacent List
For example
There are two drop down list field sitting side by side in the form
1. Select State 2. Select Course
What I want to do is have a list of states in the first drop down list (1.Select State) and depending on which state the form user selects , the second drop down list (2.Select Course) will populate with a selction of courses available in that selected state only (i.e. it will on;y show course available in QLD if QLD is selcted).
Is this hard to do?Hi,
I would recommend some posts from Stefan Cameron's blog:
http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/
http://forms.stefcameron.com/2006/09/29/selecting-specific-database-records/
http://forms.stefcameron.com/2006/12/18/databases-inserting-updating-and-deleting-records/
http://forms.stefcameron.com/2006/12/07/better-form-design-with-xfa-25/
Hope that helps,
Niall -
How to assign drop down list in XML form to properties
Hi ALL,
When i was creating <b>Edit form</b> in XML Forms Builder,for <b>Bulletin Board</b> Application, i had to assign two drop down list boxes to properties created under Content Management Configuration > Global Services > Property Metadata. Can any one help me how to ASSIGN it or provide any related documents.
Suitable replies will be rewarded, for sure.
Regards,
ShankarHi Shankar
Please have a look at this document, especially the part about the cookbook. It explains how to add properties in a dropdown list to your XML form.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ee639033-0801-0010-0883-b2c76b18583a
Good Luck!
Barry -
Hello,
I have two drop down list(s) in my adobe form.
1) Employee Group
2) Employee Subgroup
Employee Subgroup drop down list is populated dynamically depending on Employee Group selected on form.
Now the issue is :
If the current value of EMp Grp = 01 and EMP sub grp = 07
Now if Emp Group is changed to 02, EMP subgroup drop down is again built in backend. So the EMP subgroup gets new set of values BUT with additional row (value = 07) of previus EP subgrp.
So the values are:
81
82
83
07 (This is old value which should not come)
How can i delete this value using script and in which event?
Regards,
Ashish GuptaHi Ashish,
On Change event of the EMPgrp Dropdown say DD1 for EMPSubgrp DD2 write the code:
if (DD2.rawValue ne null)
then
DD2.deleteItem(DD2.selectedIndex)
DD2.rawValue = ""
endif
And make sure this script runs before the new values in the DD2 are fetched.
Regards,
Vaibhav -
LiveCycle Designer 8.0 - Linked Drop Down Lists
Hi,
Im new to Adobe LiveCycle and trying to link two drop down lists. I want the second drop down list to have certain options visible, depending upon the choice selected in the first list.
I have spent a bit of time with JavaScript and trying to link them, however am struggling.
Can anyone advise?
TIA, Mike.Hi Mike -
You can accomplish what you are describing with an array.
An example of what you are asking about can be found in the Live Cycle Interactive Purchase Order sample found at [installdir]\EN\Samples\Purchase Order\Interactive (at least that's where I found mine, I'm using Live Cycle Designer version 7).
There are two drop-down lists in this Purchase Order sample: Country and State/Province. Only two countries are listed for the purpose of the example however you can customize the script by adding other countries.
Look for the script object named 'countryScript'. It contains the logic invoked by the drop-down lists when the form is created and based on the user interaction. -
Drop down list driven by drop down list
I have two drop-down lists, the second one is driven by the first selection, I am wondering how to do it.
Is it similar as the page refreshed by drop-down list?Check out this Coordinated Dropdown Sample Application :
http://developers.sun.com/prodtech/javatools/jscreator/reference/code/sampleapps/2/2update1/CoordinatedDropDowns.zip
This application demonstrates how the powerful event handling mechanism in JavaServer Faces can be used to dynamically update the state of various components on a single page.
HTH,
Sakthi
Maybe you are looking for
-
HR Forms Issue - Payroll Simulation
Hi all, I have requirement to run HR Forms through payroll simulation. When I run for certain scenario, at a time 9 periods are processed as below. Each period is generating 1 HR Form each, totally 9 HR Forms are generated. In the Form Interface, I h
-
Storing formatted text in Oracle 11GR2
One of our developers would like to be able to store and retrieve formatted text in a column in a table in Oracle 11GR2. The text can contain bold characters, underlines, italics, punctuation, symbols (such as bullets), CRLF's or pilcrows. The text m
-
Connecting HP990Cse via print sever in Windows 7 64bit
I want to install the drivers for an HP990Cse printer which is connected through a printer server built into my WD Netcenter network drive. Windows 7 (64bit) can find the printer but not the driver. Also, this printer is not found in the list provide
-
Windows 7 professional backup and restore stop working after installation of acronis true image 2010
HI, windows 7 professional backup and restore stop working after installation of acronis true image 2010. it generates a error code 0x81000019. please help. thanks Song
-
HT4528 How to back up my iphone 4s on itunes?
How do I back my iphone 4S to my itunes? The phone that Verizon sent in replacement of my damaged phone ended up being damaged, I am unable to get wifi on the phone. Where I am unable to back-up my iCloud on my phone, I now have to back it up on itun