How can I change the ListIndex of one Drop-Down listbox based on selection of another Drop-Down listbox? - InfoPath Dev
in

InfoPath Dev

How can I change the ListIndex of one Drop-Down listbox based on selection of another Drop-Down listbox?

Last post 07-09-2008 01:15 PM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-07-2008 06:27 AM

    How can I change the ListIndex of one Drop-Down listbox based on selection of another Drop-Down listbox?

    Hi,

    I'm new to InfoPath 2003 and I'm facing problem. Please can somebody help me that How can I change the ListIndex of one Drop-Down listbox based on selection of another Drop-Down listbox?

    Actually I have two Drop-Down listboxes on my form, one is filled with 'Stock Number' and second is filled with 'Description' and both are populating from MS Access database. On 'Stock Number' selection I want to change the ListIndex of 'Description'.

    Thanks,
    Azeem Siddiqui.

  • 07-08-2008 01:45 PM In reply to

    Re: How can I change the ListIndex of one Drop-Down listbox based on selection of another Drop-Down listbox?

    Hello, and welcome!

    Do you mean that you would like the items in the Description dropdown to change depending upon what is selected from Stock Number? If so, this tutorial may help you do what you wish: http://www.infopathdev.com/blogs/greg/archive/2005/07/14/Create-a-Repeating-Cascading-List-from-a-Flat-Data-Source.aspx. Let me know if I misunderstood or if you need more specific assistance.

    Hilary Stoupa

  • 07-09-2008 10:18 AM In reply to

    Re: How can I change the ListIndex of one Drop-Down listbox based on selection of another Drop-Down listbox?

    Hi Hilary,

    Thanks for reply.

    No I don't want filter the items in Description drop-down to change depending upon what is selected in Stock Number.

    I have already seen cascading examples but that is not solution for my problem actually I don't want to filter any data I want to keep my Stock Number and Description list as it is as they loaded first time. Actually following are the items in drop-downs:

    Stock Number                  Description

    1                                      Description1

    2                                      Description2

    3                                      Description3

    4                                      Description4

    Now in 'Stock Number' drop-down 1,2,3,4 items are listed and in 'Description' drop-down Description1, Description2, Description3 and Description4 items are listed and now when user select 3 in 'Stock Number' drop-down then Description3 should be appeared/selected in 'Description' drop-down automatically and vice versa means when user will select Description4 then 4 should be appeared/selected in 'Stock Number' drop-down automatically. I can achieve this functionality in Visual Basic very easily by single line of code on Change event of both drop-downs as following.

    Private Sub cboStockNumber_Change()

               cboDescription.ListIndex = cboStockNumber.ListIndex

    End Sub

     

    Private Sub cboDescription_Change()

               cboStockNumber.ListIndex = cboDescription.ListIndex

    End Sub

    Do we have access to drop-down control properties via code??

    I think now you will get what I want.

    Thanks,

    Azeem Siddiqui

  • 07-09-2008 01:15 PM In reply to

    Re: How can I change the ListIndex of one Drop-Down listbox based on selection of another Drop-Down listbox?

    Well, what you would be setting is the value of the field bound to the drop down list box, and yes, you can do that in code, but you can also use rules for this.

    For example, on your Stock Number box, you can set a rule that if the field bound to the Stock Number box has a particular value, set the field bound to the Description to a particular value. So, your rule on the Stock Number ddl would have the action of setting a field's value with the field bound to the Description set to the value of the field bound to the Stock Number.

    For code, you would need to get the node value of the node bound to the Stock Number, then set the value of the node bound to the Description drop down.

    Let me know if you need more detail, okay?

    Hilary Stoupa

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