Tabbed navigation - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Tabbed navigation

Last post 04-21-2009 02:26 PM by ocampod84. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 04-20-2009 11:52 AM

    Tabbed navigation

     Hello, I'm hoping that someone can help me out.

     I created a really nice form in InfoPath 2007 that used tabbed navigation, managed by a small script, following a tutorial I found online.

    Basically, I have buttons that when clicked, show only certain sections of the form.

    Now, the problem is, jscript isn't browser compatible. Can anyone tell me how to duplicate this using either VB or C# so that can keep the pretty tabs I created, rather then using the built in switch views feature?

     I know very little about code, so if you can dumb it down for me, that's perfect. 

    Filed under: , ,
  • 04-20-2009 12:00 PM In reply to

    I'm not too familiar with browser compatible forms, but would conditional formatting/rules work in this situation? I'm an InfoPath noob as well, but I've worked with some VB in IP. Could you post your code so that others may try to understand what you are doing?

  • 04-21-2009 06:40 AM In reply to

    Yes, I could do it with rules, creating a rule where the click of the button causes a view switch, but having all these views creates a trip to the server, and I don't want that.

    What I'm looking for is someone who can tell me what the equivalent is in either C# or VB, so that the form can be browser-enabled.

    Basically, the form has three fields and three buttons. The buttons are named "summary" "remarks" and "example" and the three fields are named likewise to correspond.

    Activtab is another field in the data source, but not visible on the form itself.

    Conditional formatting is set such that when the field activetab is not equal to one of the three other fields (summary, remarks, example), that field is hidden. Also, when activetab is selected, it changes color to match the different fields. It gives the appearance of clicking on tabs.


    The code for each button:


    function summary::OnClick(eventObj)
    {
        setActiveTab("summary");
    }

    function remarks::OnClick(eventObj)
    {
        setActiveTab("remarks");
    }
    function example::OnClick(eventObj)
    {
        setActiveTab("example");
    }

    and the code for activetab:

    function setActiveTab(tabName)
    {
        XDocument.DOM.selectSingleNode("//my:ActiveTab").text=tabName;
    }




  • 04-21-2009 07:41 AM In reply to

    Here is some sample code from VB using VSTA in InfoPath 2007. You'll have edit the button's code (double click on the button and click on "Edit Form Code"). I hope this helps.

    Public Sub btnSummary_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)

    ' Write your code here.

    Dim tabName As String = "summary"

    ' // pass the string to the setActiveTab procedure

    setActiveTab(tabName)

    End Sub

    Public Sub setActiveTab(ByRef tabName As String)

    ' // select the node

    Dim activeTabNode As XPathNavigator = MainDataSource.CreateNavigator().SelectSingleNode("//my:ActiveTab", NamespaceManager)

    ' // set the value

    activeTabNode.SetValue(tabName)

    End Sub

  • 04-21-2009 08:16 AM In reply to

     Sorry, I really don't have a clue about code. But as I pasted what you typed, and it gives me this error:

     "Name 'tabname' is not declared."

    Edit:

     

    Never mind! I figured it out. Thanks a bunch!!!

     

     

  • 04-21-2009 02:26 PM In reply to

    Sorry, I didn't get back to you earlier. I'm glad that you got it figured out and that it worked.

Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.