Let’s say that I have an InfoPath form that has two views. For example, let’s call them “Main View” and “Lookup View”. One thing that I may want to do is run some code or perform a specific action when the user switches a view. For example, let’s say that I want to clear a particular field with a value. Using the On Switch Views event we can add the following code:
function XDocument::OnSwitchView(eventObj){
switch(eventObj.XDocument.View.Name)
{ case "Main View" : XDocument.DOM.selectSingleNode("//my:Field1").text = "";
case "Lookup View" : XDocument.DOM.selectSingleNode("//my:Field2").text = ""; }
}
5:59:04 PM
|