Add data to a list box from a dropdown - InfoPath Dev
in

InfoPath Dev

Add data to a list box from a dropdown

Last post 05-06-2010 07:27 AM by martinpalmer. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-05-2010 03:36 PM

    Add data to a list box from a dropdown

    I have a listbox (listBox) and a dropdown list(dropDown).  I want to be able to select an item from the dropDown and add them to the listBox.  I have looked everywhere for this but all I ever see is adding data from a datasource instead of a dropdown.  I want this to be dynamic so the listBox is populated based on the a user selected in the dropDown.  The code I have is:

     Sub btnGo_OnClick(eventObj) 

         dim field1 as XPathNavigator = xDocument.DOM.selectNodes("//my:listbox") 

         dim newNode as XPathNavigator = field1.Clone()  

         set objXMLNodes = XDocument.DOM.selectNodes("//my:myFields") 

         mytext = XDocument.DOM.selectSingleNode("//my:dropDown").text 

         temp = msgbox(mytext, vbok)                                      'so I can see, yes I am getting data from the dropdown to add to the listbox

         newNode.SelectSingleNode("value").SetValue(mytext) 

         newNode.SelectSingleNode("displayname").SetValue(mytext) 

         field1.appendchild(newNode)

    End Sub

     

  • 05-05-2010 11:18 PM In reply to

    Re: Add data to a list box from a dropdown

    you cant just go and add items to dropdown or listbox at run time like we do in .net.

    we have to bind the listbox to a repeating table and when u want to insert one more item to the listbox insert it into the repeating table and it will reflect in the list box since it is bound.

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 05-06-2010 07:27 AM In reply to

    Re: Add data to a list box from a dropdown

    ok, so what I have done is put the dropdown in a repeating table that I can parse through.  Is there a way to add a button to a column in the repeating table that will delete the associated row?

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