Tag Archives: bind

How to Bind Multiline Editbox Through Repeat Control

I have a multi-line edit-box on my xpage which is hidden. I want to allow the user to edit its value through repeat control. I don’t want to allow the user to enter multiple values separated by comma.
To achieve this functionality follow these instructions:

  • Add a multi-line edit-box and a repeat control on your xpage. I assume that there is some value already in the edit-box.
  • Set var = item and indexVar = indexItem
  • Go to the iterator code of the repeat control and return the values of the multi-line edit-box as an array.
  • Add an edit-box inside repeat control.
  • To bind it with the multi-line edit-box, select advanced in data tab then select expression language.
  • Write item[index] in the scriptbox.
  • Preview your xpage.

Sample code

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.resources>
<xp:script src="/General_SSJS.jss" clientSide="false"></xp:script>
</xp:this.resources>
<xp:table style="font-family:arial;font-size:8pt;width:100%" id="xc_MainTable">
<xp:tr>
<xp:td style="width:143.0px" colspan="2">
<xp:inputTextarea id="xc_ccSections" multipleSeparator=",">
<xp:this.defaultValue><![CDATA[#{javascript:["1-10","10-20","20-30"]}]]></xp:this.defaultValue>
</xp:inputTextarea>
</xp:td>
</xp:tr>
</xp:table>
<xp:repeat id="xc_Repeat" rows="30" var="sectionRange" indexVar="rowIndex">
<xp:this.value><![CDATA[#{javascript:var lsRange:Array = fpfSLGetArrayFromMV("xc_ccSections");

var ls2DArray:Array = new Array(lsRange.length);

var liCnt = 0;
var lsRow:Array = null;
for(liCnt = 0;liCnt < lsRange.length;liCnt++) {
lsRow = lsRange[liCnt].split("-");
ls2DArray[liCnt] = new Array(lsRow[0], lsRow[1]);
}
return ls2DArray;}]]></xp:this.value>
<xp:table style="width:100.0%" cellpadding="0" cellspacing="0">
<xp:tr>
<xp:td style="width:50.0%;text-align:center;border-left:1px solid #99B7D8; border-bottom:1px solid #99B7D8;border-right:1px solid #99B7D8;height:23px" align="center">
<xp:inputText id="xc_cc_Start" style="width:90%;font-family:Arial;font-size:8pt">
<xp:this.value><![CDATA[#{sectionRange[0]}]]></xp:this.value>
</xp:inputText>
</xp:td>
<xp:td style="width:50.0%;border-bottom:1px solid #99B7D8;border-right:1px solid #99B7D8" align="center">
<xp:inputText id="xc_cc_End" style="width:90%;font-family:Arial;font-size:8pt">
<xp:this.value><![CDATA[#{sectionRange[1]}]]></xp:this.value>
</xp:inputText>
</xp:td>
</xp:tr>
</xp:table>
</xp:repeat>
</xp:view>