Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / January 2006

Tip: Looking for answers? Try searching our database.

Switch view programmatically

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sunflower - 17 Jan 2006 04:03 GMT
I'm trying to switch view depending on the attribute of the XML document
being passed to InfoPath.

The name of the view is stored as an attribute (openView) on the root node.  
I have the following code in the OnLoad event.

function XDocument::OnLoad(eventObj)
{
    var rootNode = XDocument.DOM.selectSingleNode("/my:myFields");
    var openView = rootNode.getAttribute("my:openView");

    XDocument.View.SwitchView(openView);

}

The variable openView is being read correctly but the SwitchView is not
working.

Anyone with any bright ideas why? I suspect that the view is not available
in the onLoad event. If not, where else can I have it?

Thanks
Greg Collins [InfoPath MVP] - 17 Jan 2006 17:27 GMT
In the onload handler you must do it a little differently because the View object doesn't yet exist.

XDocument.ViewInfos(openView).IsDefault = true;

Signature

Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com

I'm trying to switch view depending on the attribute of the XML document
being passed to InfoPath.

The name of the view is stored as an attribute (openView) on the root node.  
I have the following code in the OnLoad event.

function XDocument::OnLoad(eventObj)
{
var rootNode = XDocument.DOM.selectSingleNode("/my:myFields");
var openView = rootNode.getAttribute("my:openView");

XDocument.View.SwitchView(openView);

}

The variable openView is being read correctly but the SwitchView is not
working.

Anyone with any bright ideas why? I suspect that the view is not available
in the onLoad event. If not, where else can I have it?

Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.