madheeswar
asked on
Infopath2003 and Repeating table
Hi Experts,
I am still understanding InfoPath 2003.
But as the time is limited to deliver, I do have a question.
Please consider this as urgent.
I have a repeating table and in that fields are vendor and vendorproduct.
If vendor is selected, products related to vendor need to be displayed in VendorProduct drop down list using .Net web service.
So I wrote onAfterChange code for Vendor...
Code:
function msoxd_my_Vendor::OnAfterCh ange(event Obj)
{
// Write code here to restore the global state.
var oNode = eventObj.Source;
var oNodeParent = oNode.parentNode;
if (eventObj.IsUndoRedo || eventObj.Operation != "Insert")
{
// 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.
var nodeDataSource = XDocument.DataObjects.Item ("GetVendo rProductSc hema");
nodeDataSource.DOM.setProp erty("Sele ctionNames paces", "xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-01-25T07:59:20' xmlns:tns='http://slmt.abc.com' xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution' xmlns:xd='http://schemas.microsoft.com/office/infopath/2003'");
nodeDataSource.DOM.selectS ingleNode( "//dfs:myF ields//dfs :queryFiel ds//tns:Ge tVendorPro ductSchema //tns:strS electedVen dor").text = eventObj.Source.text;
XDocument.DataObjects.Item ("GetVendo rProductSc hema").Que ry();
}
The above works fine if there is a single row. If I add another row while data entry, the value selected in Vendor Product in row 1 is lost. since the value for vendor is different in row2. it displays products related to row2.
I don't have any Rules for Vendor or VendorProduct.
But for VendorProduct I have List Box entries set to 'Lookup values in a data connection to a database, Web Service.....'
Data Connection name is "GetVendorProductSchema"
Entries: /dfs:myFields/dfs:dataFiel ds/tns:Get VendorProd uctSchemaR esponse/tn s:GetVendo rProductSc hemaResult /NewDataSe t/Table/PR ODUCT_NAME
value: .
Display Name: .
I hope I made myself clear. if you have any queries on the above, do let me know.
Another question is how to display a html/.xsn file in a modal dialog box on click of a button.
PageEditor:
if I am posting this question in a wrong session, please move it to respective TA.
thanks in advance.
-maddy
I am still understanding InfoPath 2003.
But as the time is limited to deliver, I do have a question.
Please consider this as urgent.
I have a repeating table and in that fields are vendor and vendorproduct.
If vendor is selected, products related to vendor need to be displayed in VendorProduct drop down list using .Net web service.
So I wrote onAfterChange code for Vendor...
Code:
function msoxd_my_Vendor::OnAfterCh
{
// Write code here to restore the global state.
var oNode = eventObj.Source;
var oNodeParent = oNode.parentNode;
if (eventObj.IsUndoRedo || eventObj.Operation != "Insert")
{
// 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.
var nodeDataSource = XDocument.DataObjects.Item
nodeDataSource.DOM.setProp
nodeDataSource.DOM.selectS
XDocument.DataObjects.Item
}
The above works fine if there is a single row. If I add another row while data entry, the value selected in Vendor Product in row 1 is lost. since the value for vendor is different in row2. it displays products related to row2.
I don't have any Rules for Vendor or VendorProduct.
But for VendorProduct I have List Box entries set to 'Lookup values in a data connection to a database, Web Service.....'
Data Connection name is "GetVendorProductSchema"
Entries: /dfs:myFields/dfs:dataFiel
value: .
Display Name: .
I hope I made myself clear. if you have any queries on the above, do let me know.
Another question is how to display a html/.xsn file in a modal dialog box on click of a button.
PageEditor:
if I am posting this question in a wrong session, please move it to respective TA.
thanks in advance.
-maddy
ASKER
I think the above code is in C sharp.
Let me give it a try. I am using Java Script.
Need to convert your code to JS.
Thank you.
Let me give it a try. I am using Java Script.
Need to convert your code to JS.
Thank you.
oh... try it.
Actually we worked with C# only.
Actually we worked with C# only.
ASKER
Vivek,
Can you please provide the equivalent code in VB.Net or JavaScript?
I tried converting C# to VB.Net, getting errors at
Dim oSharePointDom As IXMLDOMDocument2 = CType(thisXDocument.GetDOM ("GetVendo rProductSc hema") , IXMLDOMDocument2)
Error msg:
Expected end of statement
Can u pls help...
Can you please provide the equivalent code in VB.Net or JavaScript?
I tried converting C# to VB.Net, getting errors at
Dim oSharePointDom As IXMLDOMDocument2 = CType(thisXDocument.GetDOM
Error msg:
Expected end of statement
Can u pls help...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
public void Your_Name_OnAfterChange(Da
{
// Write code here to restore the global state.
thisXDocument.DataObjects[
IXMLDOMDocument2 oSharePointDom = (IXMLDOMDocument2)thisXDoc
oSharePointDom.setProperty
IXMLDOMNodeList nSharedItem = oSharePointDom.selectNodes
objForm.arrTotalProjActual
objForm.rowcount = nSharedItem.length;
int i = 0;
while (nSharedItem.length > i )
{
objForm.arrTotalProj.Add(n
}
i = i + 1;
// A field change has occurred and the DOM is writable. Write code here to respond
// to the changes.
}
The above code sample will help you to solve your problem.
This is how we used in our projects.