How to compare value of two Combo Box
I've two Combo Box(cbFirst & cbSecond). I want to compare the value that has been selected by the user and based on the result, output is displayed. In both Combo Box I've provided the value.
Here is my code:
var a:Number;
var b:Number;
function First(evt:Event):void{
a = evt.target.value;
trace(a);
cbFirst.addEventListener(Event.CHANGE, First);
function Second(evt:Event):void{
b = evt.target.value;
trace(b);
cbSecond.addEventListener(Event.CHANGE, Second);
If (a > b){
trace("a is greater")
else
trace(b is greater);
The trace statement inside the functions are working fine and the correct value of a & b is printed. But the comparison in the if statement doesn't seem to work. Could you please help me out.
there's a typo. fix it or remove it:
var a:Number;
var b:Number;
function First(evt:Event):void{
a = evt.target.value;
trace(a);
compareF();
cbFirst.addEventListener(Event.CHANGE, First);
function Second(evt:Event):void{
b = evt.target.value;
trace(b);
compareF()
cbSecond.addEventListener(Event.CHANGE, Second);
function compareF(){
If (a > b){
trace("a is greater")
else
trace(b is greater);
Similar Messages
-
How to get value of html combo box (i.e select) in jsp?
Hello,
I was just wondering how to get value of html combo box in jsp page. My code for combo box is:
<select name="combo" size="1">
<%
List<Project> projects = mgr.getProjects();
for(Project project : projects){
%>
<option value="<%= project.getId()%>"><%= project.getName()%></option>
<%
%>
</select>
I thought combo.value might give me the value, but it throws exception.
Any help is appreciated.
Thanks.The combo does not exists in Java, but only in HTML. You have to submit the form containing the combo and then use request.getParameter("combo") to get it's value ;-)
-
Value of two combo box is not persistent on change of a third combo box
Hi All:
I have flex page in which i have 3 combo boxes. I would be
selecting first 2 combo box and when i select the third combo box ,
i would get the value of previous two combo selection and display
data accordingly.
My problme here is when i do a change in 3rd combo box the
values of other combo boxed are defaulted to "Select..." without
maintaining my previous selection.
I am stuck in this for a while. I would really appreciate if
you can help me out in this.
Thanks
Kanthere's a typo. fix it or remove it:
var a:Number;
var b:Number;
function First(evt:Event):void{
a = evt.target.value;
trace(a);
compareF();
cbFirst.addEventListener(Event.CHANGE, First);
function Second(evt:Event):void{
b = evt.target.value;
trace(b);
compareF()
cbSecond.addEventListener(Event.CHANGE, Second);
function compareF(){
If (a > b){
trace("a is greater")
else
trace(b is greater); -
How to get values in the combo box in a XML form?
Hi All,
1. I have created a property which has "Default value" as "Clothings" and "Allowed Values(csv)" as Real Estate - Sales , Clothings etc" by navigating to KM > CM > Global Services > Property Metadata > Properties.
2. In the XML form builder when I drag this property I get a combo box for this property.
3. But when I preview this by going to Content Management > Folder > New > FORMS > and select my XML form project I get a preview but it is not showing me the default values in the combo boxes which I created using the property in XML form builder.
Please Suggest me as to how to get those values (which I mentioned in property) in the combo box ?
Thanks in Advance,
Jasmine.Hi All,
I ll make the above Query Simple.
1.In Xml Form Builder when you drag a property which has some 3-4 assigned values so you are recomended to use a combo box.
2.But the problem after using COMBOBOX is I am not getting these values in the preview of the combo box.
3.Help Required please its urgent.
Thanks in advance,
Jasmine. -
How to get the current selected value of a combo box or a option button?
Hello All,
I want to catch the current selected value of a combo box and also of a option button and want save it into different variables in my code. These option button and combo box are in a SAP business one form which I have created through VB dot.net coding.
But I don't know how to do that, can any one send any example code for this.
Regards,
Sudeshna.Hi Sudesha,
If you want to get the selected values you can do it as follows: The Combo Box value you can get from the combo box. If you want to get it on the change event, you must make sure that you check when BeforeAction = False. If you want to get an Option Button value you should check the value in the data source attached to the option button.
Dim oForm As SAPbouiCOM.Form
Dim oCombo As SAPbouiCOM.ComboBox
Dim oData As SAPbouiCOM.UserDataSource
oForm = oApplication.Forms.Item("MyForm")
oCombo = oForm.Items.Item("myComboUID")
oApplication.MessageBox(oCombo.Selected.Value)
oData = oForm.DataSources.UserDataSources.Item("MyDataSourceName")
oApplication.MessageBox(oData.ValueEx)
Hope it helps,
Adele -
How to link two combo boxes? (urgent)
Hello,
I am wondering how to link two combo boxes in Acrobat Pro 9. Basically, I need to link a building with a list of rooms. There are 3 building choices in my first combo box. For the sake of example, Building A, Building B and Building C. When one of the buildings is selected, I want a 2nd combo box to display the rooms that are located in that building. So by selecting building A, you would then be able to choose a room from the list of available rooms in the second drop box. The buildings cannot share a list of rooms because they have the same room numbers. Is anyone able to help?
- TravisYou can also use ajax. When the first combo box element is selected, it will call the ajax function and that ajax function will bring the data from the database and place it in second combo box.
-
How Do I Get Item In Combo Box and Not It's Export Value?
I created a Combo Box in Adobe pdf listing Company Names in the Item field. As well, I added an abbreviation for each Company Name in the Export Value field. When I try to display the Company Name from the Item field, it displays the Export Value.
The Combo Box is named "Company-Name".
In it, I have a company called "MacKenzie" within the Item Field. It's Export Value is "MFC".
app.alert(this.getField("Company-Name").value); will display "MFC". How do I display or get the value from the Item field?You can use the getItemAt field method, like:
// Get a reference to the combo box
var f = getField("Company-Name");
// Get the index of the selected item
var a = f.currentValueIndices;
// Show the item value of the selected item
app.alert(f.getItemAt(a, false)); -
1. i have one html page - in that two combo boxes are there
2. first one called--> Bank Name and second one called-->Main Branch
3. i have a database table like BANK_MASTER(MAIN_BRANCH,BANK_NAME)
i am giving here some data for the above table:
(sbi-kurnool, sbi),(sbi-cadapah,sbi),(sbi-chittor,sbi),(ab-rangareddy,ab),(ab-varangal,ab) ..like that every bank has its own main branch in different location.
MY PROBLEM:
In HTML page, in the first combo box ie., Bank Name will display all the bank name using the table BANK_MASTER ie.,sbi,ab,cb,sbh ...... (its ok - i too get )
main Problem: Whenever i select a particular bank name in the first combo box, the second combo box ie.,Main Branch has to display the main branches using the table Bank_Master depending on the Selected bank name from the Bank Name Combo box ( ie., if we select the sbi, it has to display all main branches of sbi's only, but not other bank's main branches)Hi friend,
I had a similar situation and i tried to solve it by using XmlHttpRequest Object(used in AJAX).
U can checkout the below example just for further reference delete
UserForm.jsp:
==========
<head>
<script>
var xmlHttp
function showState(str)
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
alert ("Browser does not support HTTP Request")
return
var url="getState.jsp"
url=url+"?count="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChange
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
function stateChange()
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById("state").innerHTML=xmlHttp.responseText
</head>
<body>
<select name='country' onchange="showState(this.value)">
<option value='india>india</option>
</select>
<br>
<div id='state'>
<select name='state' >
<option value='-1'>pickone</option>
</select>
</div>
</body>
getState.jsp
============
<%@page language="java" import ="java.util.Hashtable" import ="java.util.Set" %>
<%
String country=request.getParameter("count");
response.setContentType("text/html");
response.setHeader("Cache-Control","no-cache");
try{
Hashtable ht = (Hashtable)session.getAttribute("<ATTRIBUTE_NAME>");
String buffer="<select name='state'><option value='-1'>Pick One</option>";
Set s=ht.keySet();
Object keys[]=s.toArray();
int size=keys.length;
for(int i=0; i < size;i++){
buffer=buffer+"<option value='"+ht.get(keys).toString()+"'>"+ht.get(keys).toString()+"</option>";
buffer=buffer+"</select>";
response.getWriter().println(buffer);
catch(Exception exp){
response.getWriter().println(exp);
%> I think u may go upon replacing country with your Main Branch and vice versa -
How to select an item in combo box...!
How to select an item in combo box in order to appear in a box of text (programmed in VB.Net for SAP Business One).
Hi Carlos,
I am not sure if this is what you want, but here's an example of selecting a value in a combo box. This is the item master data window and I'm changing Item Type to Labor.
Dim oCombo As SAPbouiCOM.ComboBox
Dim oForm As SAPbouiCOM.Form
oForm = oApplication.Forms.ActiveForm
oCombo = oForm.Items.Item("214").Specific
oCombo.Select("L", SAPbouiCOM.BoSearchKey.psk_ByValue)
Hope it helps,
Adele -
How to edit items of a combo box that is part of an array of clusters
Hi,
In the attached vi, I have an array of clusters, and each cluster contain two combo boxes. How do I edit the items in Combo Box 1 for all elements of the array? (All Combo Box 1 elements shall include the same items.)
For illustration, I also included the trivila case, i.e., editing the items in a separate combo box that is is not part of an array of clusters (Combo Box 3). Please advise. Thanks.
Peter
Solved!
Go to Solution.
Attachments:
Question Combo Box in Array of Clusters.vi 16 KBPlease mark S_Mercurio's message as the solution to your question rather than your own thank you message. First you will have to unmark yours by going to the option menu to the upper right of your message.
-
I am using a combo box as a select list for text serial commands. I have items like "engineering", "GUI", and "Scan" for the commands "MDE", "MDN", and MDS respectively which i have input as the corresponding value in the combo box. so for example the label "engineering" has the value "MDE" in the combo box items list. when the Vi starts it needs to read the current value MDE, MDN, or MDS and then i want it to display on the front panel the item text corresponding to that command value.
To do this i have tried to read the serial command, ie MDS and then wire that to a "value" property of a property node of the combo-box, but instead of displaying the corresponding item label, "Scan", it displays the value "MDS" on the front panel instead. i want the front panel to use the label text when choosing and displaying but the block diagram to use the serial commands. Can this be done with a combo box? I'm trying to use a combo box so i can keep it all text and avoid having to build a case statement to convert enums or rings from a numerical value to the text command.
The correct text value is wired to the value property and it does exist in the combo-box. I have unchecked "values match items" and selected to not allow undefined values.Don't use the value property node. Use the Text.Text property node. When creating the property node, select Text, then in the next pop-up box, select Text.
- tbob
Inventor of the WORM Global -
Need to compare values in two columns of one table against values in two columns in another table
Hi, as the title reads, I'm looking for an approach that will allow me to compare values in two columns of one table against values in two columns in another table.
Say, for instance, here are my tables:
Table1:
Server,Login
ABCDEF,JOHN
ABCDEF,JANE
FEDCBA,SEAN
FEDCBA,SHAWN
Table2:
Server,Login
ABCDEF,JOHN
ABCDEF,JANE
FEDCBA,SHAWN
In comparing the two tables, I'd like my query to report the rows in table1 NOT found in table2. In this case, it'll be the 3rd row of table one:
Server,Login
FEDCBA,SEAN
Thanks.create table Table1([Server] varchar(50), Login varchar(50))
Insert into Table1 values ('ABCDEF','JOHN'),('ABCDEF','JANE'),('FEDCBA','SEAN'),('FEDCBA','SHAWN')
create table Table2([Server] varchar(50), Login varchar(50))
Insert into Table2 values ('ABCDEF','JOHN'),('ABCDEF','JANE'), ('FEDCBA','SHAWN')
select [Server] ,Login from Table1
Except
select [Server] ,Login from Table2
select [Server] ,Login from Table1 t1
where not exists(Select 1 from Table2 where t1.[Server] = t1.[Server] AND Login=t1.Login)
drop table Table1,Table2 -
How to implement alphabetic search in combo box
Hi all,
how to implement alphabetic search in combo box through coding.
Thanks for any repliesIm not sure if I undestand correctly, but example is
sCFL_ID = oCFLEvento.ChooseFromListUID
Dim oCFL As SAPbouiCOM.ChooseFromList
oCFL = oFormKontrolaMZ.ChooseFromLists.Item(sCFL_ID)
If oCFLEvento.BeforeAction = False Then
Dim oDataTable As SAPbouiCOM.DataTable
oDataTable = oCFLEvento.SelectedObjects
val = oDataTable.GetValue(1, 0)
oForm.DataSources.UserDataSources.Item("EditDS").ValueEx = val
and then load from datasource to matrix.
hope it helps
Petr -
Retriving data from database on selecting particular value in the combo box
Hi,
On selecting the particular value from the combo box, the corresponding value of the other segement fields should be retrived from databse and displayed in the text boxBabel,
If you don't have a query bdoc and the business query that joins both 2 tables already, then please crate one.
After that, write this code on the change of the combobox.
You would have to change the names below for the Query, properties, anchor, parameters, controls.
===================================
Private Sub ctrlBankNameCombo_onValueChanged2(ByRef boundAttributeChanged As Boolean)
On Error Resume Next
Dim objBankQuery As BusinessQuery
Dim ObjBankCol As BusinessCollection
Dim strID As String
If Not boundAttributeChanged Then Exit Sub
strID = ""
strID = myanchor.bo.getAttribute("BankNameComboProperty") ' Bank ID
If strID <> "" Then
Set objBankQuery = gServices.factory.newBusinessQuery("MyNewQuery")
objBankQuery.Mandt = "000"
objBankQuery.BANKID = strID
Set ObjBankCol = objBankQuery.query
If Not ObjBankCol Is Nothing Then
ctrlBankAddress.Value = ObjBankCol.getAttribute(1, "BankAddress")
ctrlBankPhone.Value = ObjBankCol.getAttribute(1, "BankPhone")
End If
End If
===================================
Regards,
Vadim. -
Form development - Getting a value from a combo box
Hey,
I have recently started form development in IDM. I seem to have stumbled at the first hurdle. I have created a combo box with some hard coded values. I want a variable to hold the value of what is currently selected in the combo box. The reason is what is selected in the combo box will affect what appears further down on the form.
Can anyone help me achieve this?
Thanks for your timeThere may be many good answers to this problem. One may be the fact that the value of the combo box is accessible futher down in the form simply by referencing the name of the combo box.
For example, if the name of the combo is cmbVal and assuming the base context is variables, you can later reference that field (in a Disable, Derivation, Expansion...) with <ref>cmbVal</ref>.
If the base context was variables.user, the same would hold true, let's say, for waveset.capabilities, where the reference would be <ref>waveset.capabilities</ref>.
A more creative alternative might include setting a Process, Activity, or Action level variable in the expansion of the combo and then referencing that value later on. This requires that the combo has action and isn't as good of a solution as the first.
Hope that helps.
Maybe you are looking for
-
My Calendar doesn't update with iPhone sync even though it then updates my iPad
My Calendar on my iMac doesn't update when syncing with iPhone (the most updated device on my Calender), even though it then updates after I sync my iPad? By this I mean it updates the system on my iMac because it then passes it onto my iPad. Help PL
-
everytime I enter itunes it says this: their has occured an unknowned error (11222) and sometimes it just says itunes couldnt connect to itunes store: make sure your network connection is active what do I do?
-
I've been working on a project and everything was working fine. I close the program and reopened it an hour later. Now, I keep getting this error message: "This project contains a sequence that could not be opened. No sequence preview preset file or
-
For P7-1030 with Windows 7: I am trying to upgrade graphics by installing a Visiontek 6350 Radeon PCe-16 Graphics Card into the PCE-16 slot. I have replaced the original 240 watt power supply with a Thermaltake 575 Watt Smart Power Supply. QUESTION:
-
Lenovo c200 3000, shuts off after 2, 3 min
Hi there I have lenovo 3000 c200, it is 5 years old It shuts off after 2 to 5 min. First i thought it is from the fan and i changed it, but still the same. Then I reapplied the thermall paste and still no difference. The fan starts and stops for like