Multiple-selection listbox first item null - InfoPath Dev
in

InfoPath Dev

Multiple-selection listbox first item null

Last post 05-02-2012 09:44 AM by Marlena. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-01-2012 01:26 PM

    Multiple-selection listbox first item null

    When I run my form and select items from the multiple selection listboxes, I show null items in the saved xml:

    <my:LegMarkings>
        <my:LegMarking xsi:nil="true"></my:LegMarking>
       <my:LegMarking>1</my:LegMarking>
       <my:LegMarking>2</my:LegMarking>
    </my:LegMarkings>
    <my:BodyMarkings>
        <my:BodyMarking xsi:nil="true"></my:BodyMarking>
       <my:BodyMarking>6</my:BodyMarking>
    </my:BodyMarkings>

    I don't see any blank entries in the lists or in the datasource so I am wondering where the "nil=true" nodes are coming from. Any ideas where I might look?

  • 05-02-2012 09:21 AM In reply to

    Re: Multiple-selection listbox first item null

    In 2010, go to Data tab -> Default Values -> uncheck the field that MSLB control is bound to.  That should get rid of your null value.
    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 05-02-2012 09:44 AM In reply to

    Re: Multiple-selection listbox first item null

    Thanks Anson. I tried these but it seemed to break the rules I have to show and hide the MSLB. I ended up writing some code:

     

                    XPathNavigator nav = CreateNavigator().SelectSingleNode("/dfs:myFields/my:Markings/my:BodyMarkings/my:BodyMarking", NamespaceManager);
                    if (nav.InnerXml == "")
                        CreateNavigator().SelectSingleNode("/dfs:myFields/my:Markings/my:BodyMarkings/my:BodyMarking", NamespaceManager).DeleteSelf();
                    nav = CreateNavigator().SelectSingleNode("/dfs:myFields/my:Markings/my:LegMarkings/my:LegMarking", NamespaceManager);
                    if (nav.InnerXml == "")
                        CreateNavigator().SelectSingleNode("/dfs:myFields/my:Markings/my:LegMarkings/my:LegMarking", NamespaceManager).DeleteSelf();

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