Sets the window of the Infopath form to the name you specify
function XDocument::OnSwitchView(eventObj) { XDocument.View.Window.Caption = "Name of Form"; }