How to show selected item in dropdown? - InfoPath Dev
in

InfoPath Dev

How to show selected item in dropdown?

Last post 06-15-2009 07:15 AM by Harsh. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 06-10-2009 04:38 AM

    • Harsh
    • Not Ranked
      Male
    • Joined on 06-09-2009
    • Gurganon
    • Posts 6

    How to show selected item in dropdown?

    Hi,
    I need to show the ith item of dropdown as selected.
    How can i achieve that in infopath's dropdown?

    Thanks
    Harsh

     

     

  • 06-10-2009 05:14 AM In reply to

    Re: How to show selected item in dropdown?

     Hi,

    Get the ith value using the following expression.

    count(../preceding-sibling::my:group2) + 1

    get the xpath of the value which you want to display in the drop down (i.e., secondary data source xpath). Place the above expression in the index of repeating group.

    For ex: xdXDocument:GetDOM("emp")/Emps/Emp[count(current()/../preceding-sibling::my:group2) + 1]/EmpID

    Here emp is a secondary xml.

    Swathip
    www.ggktech.com
  • 06-10-2009 05:41 AM In reply to

    • Harsh
    • Not Ranked
      Male
    • Joined on 06-09-2009
    • Gurganon
    • Posts 6

    Re: How to show selected item in dropdown?

    Hi swathip,
    Thanks for the reply.But can you make a bit easy by explaning the things.
    Actually i am using VB script for my infopath form.
    What i am looking for is the VB script code by which i can set the dropdown with ith element.
    For eg. if there are 3 items in dropdown list then there should be 3 rows each containing dropdown .First dropdown should have 1st item slected,second dropdown should have second item selected and so on.
    currently i am able to generate the 'i' rows  dynamically each having the dropdown,but anable to show them selected.

    Please help me.and if possible send me some sample code in vbscript.

  • 06-10-2009 05:50 AM In reply to

    Re: How to show selected item in dropdown?

    Hi Harsh,
     
    May I know why do you want to set the value using code?
    It is easy that the way I expained in the forum without using code even though you are creating the rows through code.
    Swathip
    www.ggktech.com
  • 06-10-2009 06:11 AM In reply to

    • Harsh
    • Not Ranked
      Male
    • Joined on 06-09-2009
    • Gurganon
    • Posts 6

    Re: How to show selected item in dropdown?


    i couldn't figure out where to paste the code u have given ,in my design template( u said Place the above expression in the index of repeating group.) where it is??
    Please explain it step by step if poossible and what is Empid and grp2 in the code?
    will it give me the desired result as i mentioned?

  • 06-10-2009 06:17 AM In reply to

    Re: How to show selected item in dropdown?

    Hi,

    Give me the xpath of the drop down list and the xpath of the value you want to show in your drop down list and also give the name of the secondary data source.

    Swathip
    www.ggktech.com
  • 06-15-2009 07:15 AM In reply to

    • Harsh
    • Not Ranked
      Male
    • Joined on 06-09-2009
    • Gurganon
    • Posts 6

    Re: How to show selected item in dropdown?

    Xpath of dropdown is
    myFields/Level1/Level2/ddMachineCenter

    DropDown XML structure
    MCs/MC

    DataSource Query
    "Select MachineCenterName from MachineCenters"
    hence i am binding 'MachineCenterName'

    Please tell me if its helpful enough to understand my problem or i need to send u some thing more?

     

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