Solved

xpage addlistbox

Posted on 2012-03-20
16
1,390 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-
  • 6
  • 6
  • 3
  • +1
16 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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-
Comment Utility
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
Comment Utility
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
 

Author Comment

by:TAI-
Comment Utility
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
Comment Utility
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
Comment Utility
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-
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
Last time: your source code please... :-|
0
 

Author Comment

by:TAI-
Comment Utility
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
Comment Utility
Thanks, but is that all?
0
 
LVL 46

Expert Comment

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

Author Comment

by:TAI-
Comment Utility
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
Comment Utility
did you test the code i posted?
0
 

Author Comment

by:TAI-
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now