Solved

xpage addlistbox

Posted on 2012-03-20
16
1,433 Views
Last Modified: 2013-12-18
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.
0
Comment
Question by:TAI-
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
  • 3
  • +1
16 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37741475
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.
0
 

Author Comment

by:TAI-
ID: 37741513
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
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37741543
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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:TAI-
ID: 37741619
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.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37741639
It's too difficult to indicate what's wrong with your approach if you don't show the code on the Source tab...
0
 
LVL 4

Expert Comment

by:umeli
ID: 37746080
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.
0
 

Author Comment

by:TAI-
ID: 37746164
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.
0
 
LVL 1

Expert Comment

by:DjGKidd
ID: 37746414
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

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37746431
Last time: your source code please... :-|
0
 

Author Comment

by:TAI-
ID: 37746446
Hi  bosman,
Which code you can want to see? I can't understand.??
 We can write the code upper te page under the button ??
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37746449
Thanks, but is that all?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37746455
Everything that is on the Source-tab please, so we can paste it in a test-page here.
0
 

Author Comment

by:TAI-
ID: 37746472
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.
0
 
LVL 1

Expert Comment

by:DjGKidd
ID: 37746491
did you test the code i posted?
0
 

Author Comment

by:TAI-
ID: 37746817
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.
0
 
LVL 1

Accepted Solution

by:
DjGKidd earned 500 total points
ID: 37746844
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

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question