Select value in DropDownList - InfoPath Dev
in

InfoPath Dev

Select value in DropDownList

Last post 08-20-2010 02:29 AM by Ramesh.N. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 04-11-2007 05:51 AM

    • milos
    • Not Ranked
    • Joined on 04-11-2007
    • Yugoslavia
    • Posts 2

    Select value in DropDownList

    I have a dropdown list connected with secondary data source (external SQL Server database).
    Secondary data source contains two attribute fields:
    - VENDOR_ID
    - VENDOR_NAME

    By default, dropdown list does not have default value so I have to select some value from the list.

    Is it possible to programmatically set default value of the dropdown list to certain item?
    For example I would like to set dropdown list value to the first or second vendor from the recordset.

    PS: This is my first post. I found lot of usefull information on your site. You are doing very good job with this portal!
    I will recommend it to everyone. I think It is mandatory location for every InfoPath developer.
  • 04-11-2007 06:45 AM In reply to

    Re: Select value in DropDownList

    Hi milos, Welocme to the forum and you are right, this is a right place to know about the infopath.

    Check out this link, may be helpful for you,

    http://infopathdev.com/forums/topic.asp?TOPIC_ID=2775

    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 04-11-2007 07:23 AM In reply to

    • milos
    • Not Ranked
    • Joined on 04-11-2007
    • Yugoslavia
    • Posts 2

    Re: Select value in DropDownList

    Thanks for the prompt answer.
    Actually I do not want to set first node as default.

    I want to set default value according to some criteria. Here is my pseudo code (<someid> is my criteria):

    Dim oVendordDOM
    Set oVendordDOM = XDocument.GetDOM( "VENDOR_BASIC" )

    Dim myNode
    'select node from secondary data source based on vendor_id
    '!****** I am not sure that this XPath is correct
    Set myNode = oVendordDOM.selectSingleNode("//d:VENDOR_BASIC[@VENDOR_ID = '<someid>']")

    'set value in dropdown list
    Dim vendorId
    Set vendorId = XDocument.DOM.selectSingleNode("//my:VendorIdQ")
    '!****** This code actually adds another item in dropdown list
    vendorId.text = myNode.text

  • 04-22-2007 12:34 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Select value in DropDownList

    Hi,

    You need to change the your code as below:

    Dim oVendordDOM

    Set oVendordDOM = XDocument.GetDOM( "VENDOR_BASIC" )

    //Set the property

    oVendordDOM.setProperty(“SelectionNamespaces”, “Give Secondary DOM namespace”)

     

    Dim myNode

    Set myNode = oVendordDOM.selectSingleNode("//d:VENDOR_BASIC[@VENDOR_ID = '<someid>']")


    Dim vendorId

    //Get the drop down list node using complete xpath of main DOM 

    Set vendorId = XDocument.DOM.selectSingleNode("Give complete Xpath of the drop down list box")

    vendorId.text = myNode.text
  • 08-20-2010 02:29 AM In reply to

    Re: Select value in DropDownList

     k this fine. I need one more thing in dropdownlist. when we look up external values from an external datasource for dropdown.The first values is blank.Do have any idea to avoid this.pls let me know if you have any idea.

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