• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1520
  • Last Modified:

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.
0
TAI-
Asked:
TAI-
  • 6
  • 6
  • 3
  • +1
1 Solution
 
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.
0
 
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
0
 
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.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
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.
0
 
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...
0
 
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.
0
 
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.
0
 
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

0
 
Sjef BosmanGroupware ConsultantCommented:
Last time: your source code please... :-|
0
 
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 ??
0
 
Sjef BosmanGroupware ConsultantCommented:
Thanks, but is that all?
0
 
Sjef BosmanGroupware ConsultantCommented:
Everything that is on the Source-tab please, so we can paste it in a test-page here.
0
 
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.
0
 
DjGKiddCommented:
did you test the code i posted?
0
 
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.
0
 
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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 6
  • 6
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now