I have an xpage that contains a repeat control. The repeat generates dynamic editable fields based on values in a view. I would like the repeat to grab the data only once so that subsequent updates to the view are not received by the repeat control.
From what I understand of repeat controls this might not be possible.
Is there anyway I would be able to do this?
For what its worth here is the code sample.
<xp:repeat id="repeat2" rows="100" value="#{view6}" indexVar="rowData" var="dataCol" repeatControls="false">
<xp:tr>
<xp:td style="width:400px">
<xc:dynamicChecklistItem
itemname="#{javascript:rowData+'itemname'}"
savedname="#javascript:rowData+'savedname'}">
</xc:dynamicChecklistItem>
</xp:td>
<xp:td>
<xc:dynamicCompleted
completedField="#{javascript:rowData+'completed'}">
</xc:dynamicCompleted>
</xp:td>
<xp:td>
<xc:dynamicVerified
verifiedField="#{javascript:rowData+'verified'}">
</xc:dynamicVerified>
</xp:td>
<xp:td>
<xc:dynamicComments dsn="document1"
fieldName="#{javascript:rowData+'Comments'}">
</xc:dynamicComments>
</xp:td>
</xp:tr>
</xp:repeat>
You can set dominoView's property dataCache="full". This would save all view entry column values at first request and restore and use them at following requests without going back to view.
For advantages and disadvantages look at page 32 here.
<xp:this.data>
<xp:dominoView
var="view6"
viewName="yourView"
dataCache="full">
</xp:dominoView>
</xp:this.data>
As an alternative, you can save the values you need from view in a viewScope variable and use it in repeat control.
<xp:this.beforePageLoad><![CDATA[#{javascript:
if (viewScope.list == null) {
var view = database.getView("yourView");
var allEntries = view.getAllEntries();
var list = new Array();
var entry = allEntries.getFirstEntry();
for (var i = 0; i < allEntries.getCount(); i++) {
var columnValues = entry.getColumnValues();
var items = [columnValues.get(0).toString(), columnValues.get(1).toString()];
list.push(items);
entry = allEntries.getNextEntry();
}
viewScope.list = list}
}]]>
</xp:this.beforePageLoad>
<xp:repeat
id="repeat1"
rows="100"
value="#{viewScope.list}"
indexVar="index"
var="listElement">
<xp:text
id="computedField1"
value="#{listElement[0]}">
</xp:text>
<xp:br />
</xp:repeat>
(You would have to add recycling of Notes objects to code.)
Related
We have an XPage which is using a named JDBC connection via the OpenNTF extension library.
This is successfully retrieving data and placing it inside a View Panel, I've selected to display a Check Box next to first field in the Row, and need to access the returned value for that field in that row (or an array for multiples of the selected rows).
So far have tried these methods:
var Docs2=getComponent("viewPanelDocs");
//var db2 = Docs2.getAttributes();
//var doc2Array=Docs2.getSelectedIds();
//var test = getComponent("something");
var p=Docs2.getParent()
var pp=something.getColumnValue("extName")
var Rows = Docs2.getChildCount().valueOf();
var doc2Array= new Array();
var SelectedDocs2 = new Array();
for(i=0; i < Rows; i++) {
// Works, no output: var Selected2Docs=Docs2.getAttributes();
// FAILS: var Selected2Docs=Docs2_xspGetRendererData();
// WORKS, no output: var Selected2Docs=Docs2._xspGetRendererData();
// WORKS, gets local ID of viewPanel: var Selected2Docs=Docs2.getId();
// Works: javax.faces.component.UIComponentBase$AttributesMap#0: var Selected2Docs=Docs2.getAttributes();
// FAILS, doesn't like string: var Selected2Docs=Docs2.getAttributes("ExternalUNCLink");
// WOrks, no output: var Selected2Docs=Docs2.getAttributes().get("ExternalUNCLink");
// Fails, something, something: var Selected2Docs=Docs2.getAttributes().values("ExternalUNCLink");
var Selected2Docs=Docs2.toString().valueOf();
doc2Array.push(Selected2Docs);
}
getComponent("Docs2").value=Rows + ": " + #Implode(doc2Array, ",");
//viewScope.put("Documents", #Implode(docArray, ","));
Any clues how to access the returned value of ExternalUNCLink?
Caveat: I'm not a Domino developer, so excuse me if some of the terminology is incorrect.
[EDIT]
We have a JDBC driver, which lives in the Packages -> Web Content -> WEB-INF -> jdbc folder with a test name and four criterea in an XML style format, thus:
<jdbc>
<driver>net.sourceforge.jtds.jdbc.Driver</driver>
<url>jdbc:jtds:sqlserver://malbec/aps_dsql</url>
<user>user</user>
<password>pass</password>
</jdbc>
Then on the page we have an SQL query in the afterPageLoad event:
var TmpSql="select * from TABLE"
viewScope.put("SQLQuery", TmpSql );
getComponent("strSQLQuery").value=TmpSql;
After that, you put the viewScope variable "SQLQuery" into the value field for sqlQuery on a JDBCQuery view, using the connectionName variable of the name of the JDBC driver shown above. It returns the data, but we can't seem to access it.
[/EDIT]
[EDIT2]
(with apologies for the dogs breakfast ...)
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.afterPageLoad><![CDATA[#{javascript:var TmpSql="select A.extName,A.extUNC,A.extObjInstID,LEFT(A.extUNC,5) as Category, B.cltMailName From cdblink A inner join cdbClientMaster B on A.extobjinstid=B.objInstID where extobjectid=1 and extobjinstid in (1536,1871,632)"
viewScope.put("strSQLQuery", TmpSql);
getComponent("strSQLQuery").value=TmpSql;
getComponent('viewPanelDocs').getData().refresh();
}]]></xp:this.afterPageLoad>
<xc:testjdbcrowdataaccess></xc:testjdbcrowdataaccess>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:
// --var vp=getComponent("viewPanelDocs");
// --
// --//var test=vp._xspGetRendererData().getParent();
// --//var test=vp._xspGetStateId().valueOf();
// --//var test= vp.getChildren().lastIndexOf();
// --var test= vp.getChildren().size();
// --var test=vp.getChildCount();
// --var test=vp._xspGetStateId().valueOf();
// --//var test=vp._xspGetReadOnlyObj().hashCode();
// --//var test=vp.getAttributes().get();
// --var test=vp.getFamily().valueOf();
// --var test=vp.getParent();
// --
// --getComponent("Test").value=test.toString();
//var database=mssql_test.jdbc;
//
//var viewPanel=getComponent("viewPanelDocs");// get the componet of viewPanel
//var docIDArray=viewPanel.getSelectedIds(); //get the array of document ids
//for(i=0; i < docIDArray.length; i++){
// var docId=docIDArray[i];
// var doc=database.getDocumentByID(docId);
// .. your code to deal with the selected document
// getComponent("Test").value=doc.toString();
//}
var test = getComponent("viewPanelDocs").value;
#ErrorMessage("ID: "+test);}]]></xp:this.action>
</xp:eventHandler></xp:button>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br><xp:table id="DEBUG" style="width:100%">
<xp:tr>
<xp:td>inputText2</xp:td>
<xp:td>
<xp:inputText id="inputText2" value="#{viewScope.searchDOCID}" style="width:100%">
<xp:eventHandler event="onfocus" submit="true" refreshMode="complete" id="eventHandler2">
<xp:this.action>
<![CDATA[#{javascript:
var viewPanel:com.ibm.xsp.component.xp.XspViewPanel = getComponent('viewPanel2');
var dominoView:com.ibm.xsp.model.domino.DominoViewData = viewPanel.getData();
var filterValue = getComponent('inputText2').getValue();
if (filterValue == 'NA') {
filterValue = '';}
viewScope.clear()
dominoView.setKeys(filterValue);}]]>
</xp:this.action>
</xp:eventHandler>
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>inputText3 (displayvar)</xp:td>
<xp:td>
<xp:inputText id="inputText3" value="#{viewScope.documentDOCID}" style="width:100%">
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>Test</xp:td>
<xp:td>
<xp:inputText id="Test" style="width:100%" value="#{viewScope.test}">
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>inputText1</xp:td>
<xp:td>
<xp:inputText id="inputText1" style="width:100%"></xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>inputText4</xp:td>
<xp:td>
<xp:inputText id="inputText4" style="width:100%"></xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>SQLQuery</xp:td>
<xp:td>
<xp:inputText id="strSQLQuery" style="width:100%" defaultValue="strSQLQuery">
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>SQLQueryCat</xp:td>
<xp:td>
<xp:inputText id="strSQLQueryCat" style="width:100%">
</xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td>Doc1</xp:td>
<xp:td>
<xp:inputText id="Docs" style="width:100%">
</xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td style="width:15%">Doc2</xp:td>
<xp:td>
<xp:inputText id="Docs2" style="width:100%"></xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>scopeVariable.Documents</xp:td>
<xp:td>
<xp:inputText id="svDocuments" style="width:100%"></xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>scopeVariable.Recipients</xp:td>
<xp:td>
<xp:inputText id="svRecipients" style="width:100%"></xp:inputText>
</xp:td>
</xp:tr>
</xp:table></xp:view>
[/EDIT2]
When you have a ViewPanel that is linked to a Notes View, the selected documents can be found using the getSelectedIds() method on the viewPanel object. You then can loop through the values to get the documents and their full URLs:
var viewPanel=getComponent("viewPanel1");get the componet of viewPanel
var docIDArray=viewPanel.getSelectedIds(); get the array of document ids
for(i=0; i < docIDArray.length; i++){
var docId=docIDArray[i];
var doc=database.getDocumentByID(docId);
// .. your code to deal with the selected document
}
Might work for your JDBC use case too.
It looks like the answer to my question is a three part one - firstly we use the Domino side of things to get the boxes which are checked, thus:
var Docs2=getComponent("viewPanelDocs");
var APKArray=Docs2.getSelectedIds();
//getComponent("svDocuments").value=#Implode(APKArray,",");
Then we use the OpenNTF "Model" Java code to get an array of the documents inside the SQL selection:
// get the Array from the SQL selection
var namesArray=[];
var PathArray=[];
var locationArray = [];
var FinalNames=[];
var FinalLocations=[];
var Model:com.ibm.xsp.component.xp.XspViewColumn = getComponent("xxxviewColumn3");
var modelData=Model.getDataModel();
var Rows = Model.getChildCount().valueOf();
namesArray.push(Rows);
for(i=0; i < modelData.getRowCount(); i++) {
modelData.setRowIndex(i);
var x=modelData.getRowIndex();
var y=modelData.getRowData().getColumnValue("ExternalName").toString();
var z=modelData.getRowData().getColumnValue("ExternalUNCLink").toString();
namesArray.push(x);
locationArray.push(y);
PathArray.push(z);
}
//getComponent("Docs2").value=namesArray
Then we use the index from the Domino side, to reference the names on the SQL side, and put that into a new array:
// put the selected docs in the selected array
for(i=0; i < APKArray.length; i++) {
var z = APKArray[i].valueOf();
FinalNames.push(PathArray[z].valueOf() + "\\" + locationArray[z].valueOf())
//FinalLocations.push(locationArray[z].valueOf())
}
getComponent("Docs2").value=#Implode(FinalNames,",");
The Path + Names ends up in the Docs2 edit box. It's pretty messy, but works (I hope this doesn't ruin my caveat!!)
From this post, thank you Simon Delicata's answer and comment. I can save get selected documents from a view and save as separate documents.
I have a question about this approach. If I edit the document, I click the link which will redirect me to the edit page, the edit page is similar to previous post's design: a combo box on the top, a view with check box (this view is used for selection), a button for save the selection values from the view and the combo box. Also there will another view which will display the saved values.
Here code and it can save as separate documents but it cannot show the saved value and put a "tick" symbol in the checkbox.
<xp:table id="table1a">
<xp:tr>
<xp:td id="table1">
<xp:comboBox id="comboBox1"
dojoType="dijit.form.ComboBox" style="width:250.0px"
value="#{document1.Category}">
<xp:selectItems id="selectItems3">
<xp:this.value><![CDATA[#{javascript:var SetFirstValueBlank = #Text("");
return SetFirstValueBlank;
}]]></xp:this.value>
</xp:selectItems>
<xp:selectItems id="selectItems4">
<xp:this.value><![CDATA[#{javascript:#Unique(#DbColumn(#DbName(), "CategoryListView", 1));}]]></xp:this.value>
</xp:selectItems>
<xp:eventHandler event="onchange" submit="true"
refreshMode="partial" refreshId="table1a">
</xp:eventHandler>
</xp:comboBox>
<xp:text escape="true" id="computedField1">
</xp:text>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:viewPanel rows="10" id="viewPanel1" var="rowData">
<xp:this.data>
<xp:dominoView var="view1"
viewName="hListView">
</xp:dominoView>
</xp:this.data>
<xp:viewColumn columnName="ItemName"
id="viewColumn1" style="background-color:rgb(255,255,255)"
showCheckbox="true">
<xp:viewColumnHeader value="Item Name"
id="viewColumnHeader1" rendered="false">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:this.facets>
<xp:pager partialRefresh="true"
layout="Previous Group Next" xp:key="footerPager" id="pager2">
</xp:pager>
</xp:this.facets>
</xp:viewPanel>
<xp:br></xp:br>
<xp:button value="Add" id="button1"
style="height:35.0px">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:var Category = getComponent("comboBox1").getValue();
var viewPanel=getComponent("viewPanel1");
var docIDArray=viewPanel.getSelectedIds();
var unidArray = new Array();
for(i=0; i < docIDArray.length; i++) {
var unid=database.getDocumentByID(docIDArray[i]).getUniversalID();
unidArray.push(unid);
}
viewScope.put("unidArray", #Implode(unidArray, ","));
for(var i=0; i< unidArray.length;i++ )
{
var mdoc = database.createDocument();
mdoc.appendItemValue("Form", "ItemForm");
mdoc.appendItemValue("ItemName",unidArray[i]);
if(mdoc.computeWithForm(false,false))
{
mdoc.save(true, true);
getComponent("computedField9").setValue("Record saved");
}
else
{
}
}
}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:viewPanel rows="6" id="viewPanel2">
<xp:this.data>
<xp:dominoView var="view2" viewName="CategoryItemView">
<xp:this.categoryFilter><![CDATA[#{javascript:getComponent("comboBox1").getValue();}]]></xp:this.categoryFilter>
</xp:dominoView>
</xp:this.data>
<xp:this.rendered><![CDATA[#{javascript:var value = getComponent("comboBox1").getValue();
if(value =="" || value == null)
{
return false;
}
else
{
return true;
}}]]></xp:this.rendered><xp:viewColumn id="viewColumn4" columnName="Category" rendered="false">
<xp:this.facets>
<xp:viewColumnHeader xp:key="header" id="viewColumnHeader4" value="Category">
</xp:viewColumnHeader>
</xp:this.facets>
</xp:viewColumn>
<xp:viewColumn id="viewColumn3" columnName="$10">
<xp:this.facets>
<xp:viewColumnHeader xp:key="header" id="viewColumnHeader3" value="Category">
</xp:viewColumnHeader>
</xp:this.facets>
</xp:viewColumn>
<xp:viewColumn columnName="ItemName" id="viewColumn2">
<xp:viewColumnHeader value="Item" id="viewColumnHeader2">
</xp:viewColumnHeader>
</xp:viewColumn>
<xp:this.facets>
<xp:pager partialRefresh="true" layout="Previous Group Next" xp:key="footerPager" id="pager3">
</xp:pager>
</xp:this.facets></xp:viewPanel><xp:br></xp:br></xp:td>
</xp:tr>
</xp:table>
So far as I know, suppose there a edit box or a combo box, if I use data binding to bind to a field and save it, the a edit box or a combo box can show the saved value when edit.
So I would like to know can the "similar approach" applies to the view? I search on the Internet and not much information about it.
I click the view and click Data in Properties tab, I notice the view does has data binding to bind to a form field.
Therefore is it possible to have data binding in the view so the view can show the saved value when edit. Thank you.
You're not binding to a document, you're binding to properties in a dominoDocument object. The dominoDocument object is a Java wrapper for the underlying document in the database that, because the document is read-write also exposes all fields as read-write, allowing editable components to be bound to them. If an edit box was bound to a read only property, I suspect it would not show as editable.
The dominoView object is a Java wrapper for the underlying view, and returns a collection of NotesXspViewEntry objects i.e. each row in the view. Those aren't read-write (Notes Client editable columns don't edit the view entry, they give an editable area that writes to the underlying document via backend code). You need to think about binding to "documents corresponding to view entries in the view".
View Panel columns can contain components instead of just mapping to column values. A View Panel is a repeat control with restricted layout and settings, so it's the same approach. Set the var property on the ViewPanel - this is a variable to get a handle on the current NotesXspViewEntry. You can't drag and drop into a column, if I remember correctly, you need to paste the code for the component into the relevant place.
If you want it editable, you'll need a dominoDocument datasource. Alternatively, reproduce the approach of Notes Client editable view column approach, bind to a temporary variable (e.g. requestScope property) and update the backend document on completion of the process. Another approach is to launch a dialog, passing the current row's UNID, and edit. Yet another approach is to use the In Place Form from XPages Extension Library.
Here's a presentation and demo from IBM Connect 2013 where I do something similar to make a column editable http://www.intec.co.uk/session-slides-and-sample-database-from-ibm-connect/.
More modern view components like the Data View make it easier.
i have a DataTable on my Xpage. I´ve filled with JavaScript an array with elements from 4 Notes Databases, which i´ve returned to the Table to show it on the DataTable.
This works, but now i need a search (edit box with search button) to search and update the results in the DataTable.
Is this possible? I only found a solution for a datatable, which is directly bind to a view, and nothing for a "manually" filled DataTable.
This is my Datatable code , which includes the JS code to create the array
<xp:dataTable id="dataTable3" rows="990" var="coll2Test"
style="width:70%" indexVar="idx">
<xp:this.facets>
<xp:pager partialRefresh="true"
layout="Previous Group Next"
xp:key="header" id="pager8">
</xp:pager>
</xp:this.facets>
<xp:this.value><![CDATA[#{javascript:
var fa:NotesDatabase = session.getDatabase(#DbName()[0], "???????");
var faSh:NotesDatabase = session.getDatabase(#DbName()[0],"???????");
var faKb:NotesDatabase = session.getDatabase(#DbName()[0],"???????");
var fa20:NotesDatabase = session.getDatabase(#DbName()[0],"???????");
var vFa:NotesView = fa.getView("???????");
var vSh:NotesView = faSh.getView("???????");
var vKb:NotesView = faKb.getView("????????");
var v20:NotesView = fa20.getView("???????");
var doc:NotesDocument = vFa.getFirstDocument();
var docSh:NotesDocument = vSh.getFirstDocument();
var docKb:NotesDocument = vKb.getFirstDocument();
var doc20:NotesDocument = v20.getFirstDocument();
var faArr= new Array();
while(doc!= null) {
var eintrag = new Array();
eintrag.push(doc.getItemValue("Name"));
eintrag.push(doc.getItemValue("Description"));
faArr.push(eintrag)
doc = vFa.getNextDocument(doc);
}
while(docSh!= null) {
var eintrag = new Array();
eintrag.push(docSh.getItemValue("Name"));
eintrag.push(docSh.getItemValue("Description"));
faArr.push(eintrag)
docSh = vSh.getNextDocument(docSh);
}
.....
//another 2 while
...
return faArr;}]]></xp:this.value><xp:table>
<xp:tr>
<xp:td>
<xp:label
value="Suche:" id="label14"
style="font- weight:bold">
</xp:label>
</xp:td>
<xp:td>
<xp:inputText
id="inputText7"
value="#
{viewScope.searchView6}">
</xp:inputText>
</xp:td>
<xp:td>
<xp:button value="suchen"
id="button7">
<xp:eventHandler
event="onclick"
submit="true" refreshMode="complete" immediate="false"
save="true" id="eventHandler7">
</xp:eventHandler>
</xp:button>
</xp:td>
</xp:tr>
</xp:table>
<xp:column id="column6">
<xp:this.facets>
<xp:label id="label11"
xp:key="header"
style="color:rgb(0,128,255);font-weight:bold"
value="Name">
</xp:label>
</xp:this.facets>
<xp:text escape="false"
id="computedField5">
<xp:this.value><![CDATA[#
{coll2Test[0]}]]></xp:this.value>
</xp:text>
</xp:column>
<xp:column id="column7">
<xp:this.facets>
<xp:label id="label12"
xp:key="header"
style="color:rgb(0,128,255);font-weight:bold"
value="Description">
</xp:label>
</xp:this.facets>
<xp:text escape="true" id="computedField6">
<xp:this.value><![CDATA[#
{coll2Test[1]}]]></xp:this.value>
</xp:text>
</xp:column>
</xp:dataTable>
Regards
Stefan
Write your completely filled JavaScript array into a view scope variable e.g. viewScope.AllEntries at the beginning. Fill your DataTable with
the complete array if no search string is entered.
the values matching search string if user entered a search string
This way you only need to read the data once from your four views and just filter it later depending on search string.
Move your code to beforePageLoad event. Add at the top
if (viewScope.AllEntries) {
return;
}
and replace the last line return faArr; with
viewScope.AllEntries = faArr;
This way you'll calculate faArr only once and store it in viewScope.AllEntries.
Replace your code in DataTable "value" with:
if (!viewScope.search) {
return viewScope.AllEntries;
}
...create and return an array (walking through viewScope.AllEntries)
...which contains only elements with search string viewScope.search
The search field can be an edit field bound to a viewScope like viewScope.search. Trigger a partial refresh of DataTable when user clicks on search button.
I have an EditBox control in a repeat control. Its iteration formula is:
return 5;
It is successfully displaying 4 edit boxes (the starting index is set to 1).
In SSJS, how can I get the value of the nth Edit Box?
You could set a sessionScope variable (or any scope variable) on the onchange event of the edit box and then in your SSJS reference the sessionScope variable. Here is some sample code, the bottom bit just shows your sessionScope variables on the page.
<?xml version="1.0" encoding="UTF-8"?>
<xp:repeat id="repeat1" rows="30" value="#{javascript:5}"
indexVar="rptIndex">
<xp:inputText id="inputText1">
<xp:eventHandler event="onchange" submit="true" refreshMode="complete">
<xp:this.action>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:sessionScope['text'+rptIndex] = getComponent("inputText1").getValue()}]]></xp:this.script>
</xp:executeScript>
</xp:this.action></xp:eventHandler></xp:inputText>
</xp:repeat>
<xp:table styleClass="debug">
<xp:tr>
<th>Variable Name</th>
<th>Variable Content</th>
</xp:tr>
<xp:repeat id="varRepeat" rows="30" value="#{javascript:sessionScope.keySet();}" var="scopeData">
<xp:tr>
<xp:td>
<xp:text escape="true" id="varName" value="#{javascript:scopeData}" />
</xp:td>
<xp:td>
<xp:text escape="true" id="varValue" value="#{javascript:sessionScope.get(scopeData)}" />
</xp:td>
</xp:tr>
</xp:repeat>
</xp:table>
</xp:view>
When you add a submission to an onChange event you create a rather chatty application - might bite you. The solution for setting the focus is rather different. First: focus is a client side operation, so you need a client script that 'knows what control is the first failure. The good news: XPages adds to all fields that failed a server side validation the attribute aria-invalid=true.
So you can use a dojo.onLoad script that queries that and sets the focus to the first member of the result. See also http://dontpanic82.blogspot.com/2011/07/xpages-styling-invalid-field.html
And for the query syntax:
http://dojotoolkit.org/reference-guide/1.7/dojo/query.html
Repeats are fun to deal with to say the least. If you look at examples in the teamroom template mobileThread custom control you'll see a repeat for displaying a list of replies, you'll also notice a lot of javascript to go along with it as for example running script on one button click would run on all buttons in the repeat.
If you are looking for the validation problem stwissel's solution looks the best. If this is something else and at some point you just need the value of any given edit box, maybe you should think about something like:
var domEl = dojo.byId(' <repeatControlId> ');
var textBoxes = domEl.getElementsByTagName("input");
var certainValue = textBoxes[3].value;
Now certainValue contains the value of a given edit box.
haven't tried this out, might need a little tweaking but the general idea should work I would think.
added another comment so i could add code.
Did a quick test and works fine for me, see my example below. Hope it helps. Try adding some print outs to see is it getting each bit.
<xp:repeat id="TestRepeat" rows="100" var="rowData"
indexVar="commentIndex" first="0" rendered="true">
<xp:this.value><![CDATA[#{javascript:
var dataArray = new Array();
dataArray.push(" Test");
dataArray.push(" Test");
dataArray.push(" Test");
dataArray.push(" Test");
dataArray.push(" Test");
return dataArray;
}]]></xp:this.value>
<xp:panel>
<xp:label value="Test"></xp:label>
<xp:inputText id="inputText1" value="Test" defaultValue="Test">
</xp:inputText>
<xp:br></xp:br>
</xp:panel>
</xp:repeat>
<xp:button value="Test" id="button1">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script>
<xp:executeClientScript>
<xp:this.script><![CDATA[
var domEl = dojo.byId('#{id:TestRepeat}');
var textBoxes = domEl.getElementsByTagName("input");
alert( "Value 1: " + textBoxes[0].value);
]]></xp:this.script>
</xp:executeClientScript>
</xp:this.script>
</xp:eventHandler>
</xp:button>
X-pages document data not visible in NOTES client but is working perfectly in the browser.
There is test page, where I have a repeat control, ignores the data in Notes Client and In browser it works perfect,
below are the images.
Notes output.
Browser output
In the above images the first image is of notes client and 2nd one is of browser.
Just to verify, I have passed the "View" in the page and the "view" is shown properly in both browser and notes clients.When I written the below exam code to just retrieve the data in test page using the repeat control, The issue is clear in images,
Any suggestion will be appreciated.Thank you.
Edit 1: Source Code ( Have just updated the images for this test)
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:div align="center">
<xp:table style="width:50%;text-align:center">
<xp:tr>
<xp:td>
<xp:label value="ID" id="label1"></xp:label>
</xp:td>
<xp:td>
<xp:label value="FORM" id="label2"></xp:label>
</xp:td>
</xp:tr>
<xp:repeat id="crepeat1" rows="30" var="c" indexVar="i">
<xp:this.value><![CDATA[#{javascript:var v:NotesView = database.getView("all_open_events");
var category = #Name("[Abbreviate]",#UserName());
return v.getAllEntriesByKey(category);
}]]></xp:this.value>
<xp:tr>
<xp:td>
<xp:text escape="true" id="computedField1">
<xp:this.value><![CDATA[#{javascript:return i +".";}]]></xp:this.value>
</xp:text>
</xp:td>
<xp:td>
<xp:text escape="true" id="computedField2">
<xp:this.value><![CDATA[#{javascript:var doc:NotesDocument = c.getDocument();
return doc.getItemValueString('form');}]]></xp:this.value>
</xp:text>
</xp:td>
</xp:tr>
</xp:repeat>
</xp:table>
</xp:div>
</xp:view>
Very common mistake: you do not specify server in data source. XPages from server work (current server), but for XPiNC you must specify server name or make a local replica of the database (XPages run on local).