unhiding optional sections depending on a number from a drop down list - InfoPath Dev
in

InfoPath Dev

unhiding optional sections depending on a number from a drop down list

Last post 08-31-2012 09:53 AM by rhatch. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-30-2012 02:14 PM

    • rhatch
    • Not Ranked
    • Joined on 08-30-2012
    • Posts 2

    unhiding optional sections depending on a number from a drop down list

    I figured out how to add one but what about if I want two or three to show based on the number of sections they need? using Microsoft.Office.InfoPath; using System; using System.Windows.Forms; using System.Xml; using System.Xml.XPath; using mshtml; namespace TestForm { public partial class FormCode { public void InternalStartup() { EventManager.XmlEvents["/my:myFields/my:field2"].Changed += new XmlChangedEventHandler(field2_Changed); } public void field2_Changed(object sender, XmlEventArgs e) { if (e.NewValue.Equals("1")) CurrentView.ExecuteAction( ActionType.XOptionalInsert, "group2_2"); else { XPathNavigator node = MainDataSource.CreateNavigator().SelectSingleNode( "/my:myFields/my:group2", NamespaceManager); CurrentView.SelectNodes(node, node, "CTRL4"); CurrentView.ExecuteAction( ActionType.XOptionalRemove, "group2_2"); { } } } } }
  • 08-31-2012 02:42 AM In reply to

    Re: unhiding optional sections depending on a number from a drop down list

    Trying to use this approach is more headache and complications than it's worth, unless you've got a really good reason.

    The typical approach is to have an ordinary section and just use conditional formatting to hide or show it accordingly.  No code needed.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-31-2012 09:53 AM In reply to

    • rhatch
    • Not Ranked
    • Joined on 08-30-2012
    • Posts 2

    Re: unhiding optional sections depending on a number from a drop down list

    I am making a form that in step 1 you pick the number of cartons 1-20 , step 2 user's info, step three details about the carton, I wanted to make step 3 add parts depending on the number of cartons requested and within that section depending on the issue change the section reflecting the issue. We already have this form and it works as a .asp using html and java script but are trying to migrate these forms to infopath and sharepoint, I am not a strong C# programmer and am very new to infopath and I was able to figure out how to add sections but only in form filler not as a blank form, I have been reading about conditional formatting  and have not seen how that would solve my problem?

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