xpage addlistbox

Hello,
We use xpage in lotus designer.And we want to make a form .This form is include tree listboxes.
My department personal name are listed one list box and  random numbers are listed in the other list box. And I want to select the data in two list boxes and when I push the add button at that time this selected data are added in thirt list box.

For example
one list box select "EBRU" and the other list box select " 1122"  we want  to see the EBRU-1122 in the thirt list box.

We need code to behind the add buton on server side or client side.
addlist box function.
thank you.
TAI-Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
I assume you already tried something. What's your code?

On server side, you'd have to bind both listboxes each to a field or scoped variable. Then you need to write code for the click-event in the Add button, to fetch the values of the two listboxes, combine them, and add them to the Values-property of the 3rd listbox.
TAI-Author Commented:
We are tried a lot off things. For example we can make

doc=dominoDoc.getDocument();

name = dominoDoc.getValue("name");

number = dominoDoc.getValue("number");

thend = dominoDoc.getValue("secilenTakim");

var a= number+name;

doc.AppendItem(thend,number);  // it doesnt' work.  doc has appenditem function but it can't
work.

 thanks
Sjef BosmanGroupware ConsultantCommented:
Could you post the source of the form, the XML-like code?

For debugging purposes, you can add Print-statements, the output is displayed on the console or in the log database. So add
      print("name: " + name)
after the line where you get the name-value.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

TAI-Author Commented:
of course print command is work correctly for selectted values like name  but it can' be set the thirtlist box. and
this code is work in the javascript so it can't be debugging.
Sjef BosmanGroupware ConsultantCommented:
It's too difficult to indicate what's wrong with your approach if you don't show the code on the Source tab...
umeliCommented:
hi
you should have someting like

var name=getComponent("listbox1").getValue();
var number = getComponent("listbox2").getValue();
var result = name+"-"+number;
getComponent("listbox3").setValue(result);

in your add button server side event.
TAI-Author Commented:
hi,
 We try this method but it can't work.  we haven't get any error but it can't be save.

We can try another method
add this code to the client server side.

var name = document.getElementById("#{id:name}");

var number = document.getElementById("#{id:number}");

var listbox3 = document.getElementById("#{id:listbox3}");

var bb = name.value+number.value+listbox3.value;


secilen.options[0].value=bb;
secilen.options[0].label=bb;



when we use this code, we can see the new value on the form  but  if we can select the new value  ,we can 't save this form. If we can't select the new value in the listbox3  and save. I can the listboxvalue3 is null.

Thank you.
DjGKiddCommented:
I don't know why would you need to select the third value, so I created a page with 2 comboboxes and one input field. Test it to see how it works.
This is the whole source code of the Xpage:
<xp:comboBox id="comboBox1">
		<xp:selectItem itemLabel="EBRU" itemValue="EBRU"></xp:selectItem>
		<xp:selectItem itemLabel="TEST" itemValue="TEST"></xp:selectItem>
		<xp:selectItem itemLabel="OTHER" itemValue="OTHER"></xp:selectItem>
		<xp:eventHandler event="onchange" submit="true"
			refreshMode="complete">
			<xp:this.action><![CDATA[#{javascript:var comboBox1:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox1");
var comboBox2:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox2");
var inputText1:com.ibm.xsp.component.xp.XspInputText = getComponent("inputText1");

var combo1 = comboBox1.getValue()
var combo2 = comboBox2.getValue()

var result = combo1 + "-" + combo2;
inputText1.setValue(result);}]]></xp:this.action>
		</xp:eventHandler></xp:comboBox>
	<xp:comboBox id="comboBox2">
		<xp:selectItem itemLabel="23423" itemValue="23423"></xp:selectItem>
		<xp:selectItem itemLabel="765" itemValue="765"></xp:selectItem>
		<xp:selectItem itemLabel="756645" itemValue="756645"></xp:selectItem>
		<xp:eventHandler event="onchange" submit="true"
			refreshMode="complete">
			<xp:this.action><![CDATA[#{javascript:var comboBox1:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox1");
var comboBox2:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox2");
var inputText1:com.ibm.xsp.component.xp.XspInputText = getComponent("inputText1");

var combo1 = comboBox1.getValue()
var combo2 = comboBox2.getValue()

var result = combo1 + "-" + combo2;
inputText1.setValue(result);}]]></xp:this.action>
		</xp:eventHandler></xp:comboBox>
	
	<xp:inputText id="inputText1"></xp:inputText>

Open in new window

<xp:comboBox id="comboBox1">
		<xp:selectItem itemLabel="EBRU" itemValue="EBRU"></xp:selectItem>
		<xp:selectItem itemLabel="TEST" itemValue="TEST"></xp:selectItem>
		<xp:selectItem itemLabel="OTHER" itemValue="OTHER"></xp:selectItem>
		<xp:eventHandler event="onchange" submit="true"
			refreshMode="complete">
			<xp:this.action><![CDATA[#{javascript:var comboBox1:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox1");
var comboBox2:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox2");
var inputText1:com.ibm.xsp.component.xp.XspInputText = getComponent("inputText1");

var combo1 = comboBox1.getValue()
var combo2 = comboBox2.getValue()

var result = combo1 + "-" + combo2;
inputText1.setValue(result);}]]></xp:this.action>
		</xp:eventHandler></xp:comboBox>
	<xp:comboBox id="comboBox2">
		<xp:selectItem itemLabel="23423" itemValue="23423"></xp:selectItem>
		<xp:selectItem itemLabel="765" itemValue="765"></xp:selectItem>
		<xp:selectItem itemLabel="756645" itemValue="756645"></xp:selectItem>
		<xp:eventHandler event="onchange" submit="true"
			refreshMode="complete">
			<xp:this.action><![CDATA[#{javascript:var comboBox1:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox1");
var comboBox2:com.ibm.xsp.component.xp.XspSelectOneMenu = getComponent("comboBox2");
var inputText1:com.ibm.xsp.component.xp.XspInputText = getComponent("inputText1");

var combo1 = comboBox1.getValue()
var combo2 = comboBox2.getValue()

var result = combo1 + "-" + combo2;
inputText1.setValue(result);}]]></xp:this.action>
		</xp:eventHandler></xp:comboBox>
	
	<xp:inputText id="inputText1"></xp:inputText>

Open in new window

Sjef BosmanGroupware ConsultantCommented:
Last time: your source code please... :-|
TAI-Author Commented:
Hi  bosman,
Which code you can want to see? I can't understand.??
 We can write the code upper te page under the button ??
Sjef BosmanGroupware ConsultantCommented:
Thanks, but is that all?
Sjef BosmanGroupware ConsultantCommented:
Everything that is on the Source-tab please, so we can paste it in a test-page here.
TAI-Author Commented:
Umeli can understand correctly me. You can't need the other codes. and I solve my problem  but Umeli can give me good examples so I wait his/her solutions.
thanks.
DjGKiddCommented:
did you test the code i posted?
TAI-Author Commented:
Hi,
Yes it can work with combobox thank you. Our customers want to us listbox. So we want to find add item to the listbox.
DjGKiddCommented:
Than you'd use this:
<xp:inputText id="inputText1"></xp:inputText>
	<xp:listBox id="listBox1">


		<xp:selectItem itemLabel="TEST" itemValue="TEST"></xp:selectItem>
		<xp:selectItem itemLabel="ESDF" itemValue="ESDF"></xp:selectItem>
		<xp:selectItem itemLabel="JHB" itemValue="JHB"></xp:selectItem>
		<xp:eventHandler event="onclick" submit="true"
			refreshMode="complete">
			<xp:this.action><![CDATA[#{javascript:var listBox1:com.ibm.xsp.component.xp.XspSelectManyListbox = getComponent("listBox1");
var listBox2:com.ibm.xsp.component.xp.XspSelectManyListbox = getComponent("listBox2");
var inputText1:com.ibm.xsp.component.xp.XspInputText = getComponent("inputText1");

var list1 = listBox1.getValue()
var list2 = listBox2.getValue()

var result = list1 + "-" + list2;
inputText1.setValue(result);}]]></xp:this.action>
		</xp:eventHandler></xp:listBox><xp:listBox id="listBox2">


		<xp:selectItem itemLabel="51345" itemValue="51345"></xp:selectItem>
		<xp:selectItem itemLabel="3463" itemValue="3463"></xp:selectItem>
		<xp:selectItem itemLabel="345345" itemValue="345345"></xp:selectItem>
		<xp:eventHandler event="onclick" submit="true"
			refreshMode="complete">
			<xp:this.action><![CDATA[#{javascript:var listBox1:com.ibm.xsp.component.xp.XspSelectManyListbox = getComponent("listBox1");
var listBox2:com.ibm.xsp.component.xp.XspSelectManyListbox = getComponent("listBox2");
var inputText1:com.ibm.xsp.component.xp.XspInputText = getComponent("inputText1");

var list1 = listBox1.getValue()
var list2 = listBox2.getValue()

var result = list1 + "-" + list2;
inputText1.setValue(result);}]]></xp:this.action>
		</xp:eventHandler></xp:listBox>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.