Hi,
I'm an InfoPath newbie, and I'm having problems on how to handle search, please help me out.
Initially, I have a textbox OnAfterChange event to handle logic:
function msoxd_my_PersonResponsibleAux::OnAfterChange(eventObj) {
var ADerror = "Unable to get Enterprise IDs from the server. Connection to the server may not be possible.";
if (eventObj.IsUndoRedo) { // An undo or redo operation has occurred and the DOM is read-only. return; }
// A field change has occurred and the DOM is writable. Write code here to respond to the changes.
try { if (IsUserOnline()) {
updatePeople(eventObj.Site.text);
XDocument.View.ForceUpdate(); }
}
catch (e) {
XDocument.UI.Alert(ADerror); return; }
}
function updatePeople(fieldValue) {
//Get a reference to the SDS bound to the Web Service.
var theDataObject = XDocument.DataObjects.Item("PeoplePicker");
//Set the SelectionNamespaces so that you can find the correct field.
theDataObject.DOM.setProperty("SelectionNamespaces", 'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' + 'xmlns:s0="http://tempuri.org/"');
var queryValue = theDataObject.DOM.selectSingleNode( "/dfs:myFields/dfs:queryFields/s0:GetEnterpriseIDsCompletionList/s0:prefixText" );
queryValue.text = fieldValue;
queryValue = theDataObject.DOM.selectSingleNode( "/dfs:myFields/dfs:queryFields/s0:GetEnterpriseIDsCompletionList/s0:count" );
queryValue.text = 20;
theDataObject.Query();
}
Both codes are working, but has to lose focus on the textbox first to fill the dropdownlist for the result,
I'd like to introduce a new approach trough providing a Search button, and to eliminate OnAfterChange event of the textbox:
function ::OnClick(eventObj){
var ADerror = "Unable to get Enterprise IDs from the server. Connection to the server may not be possible.";
if (eventObj.IsUndoRedo) { // An undo or redo operation has occurred and the DOM is read-only. return; }
// A field change has occurred and the DOM is writable. Write code here to respond to the changes.
try { if (IsUserOnline()) {
updatePeople(XDocument.DOM.selectSingleNode("/my:QADeliverySurvey/my:ActionItems/my:ActionItem/my:PersonResponsibleAux").text);
XDocument.View.ForceUpdate(); }
}
catch (e) {
XDocument.UI.Alert(ADerror); return; }
}
Since controls are in a repeating table, whenever I have 2 tables and I do search on the 2nd table, dropdownlist of the first table is also affected by the update which should not be :(
I don't know how to figure this out, please help me :( Or better if you can provide a better resolution..
Thanks a lot..