Populating drop down box in code - InfoPath Dev
in

InfoPath Dev

Populating drop down box in code

Last post 08-10-2006 02:49 PM by Shiraz Cupala. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 03-05-2006 06:02 PM

    • Carlos
    • Top 500 Contributor
    • Joined on 01-25-2006
    • Australia
    • Posts 31

    Populating drop down box in code

    I need to populate a drop down list with values I need, depending on a variable value. For example, if the variable is x, the drop down will only show 1 and 2. If the variable is y, the drop down will show 2 and 3.

    How to you do call the drop down in vbscript (or jscript)?
  • 03-05-2006 08:10 PM In reply to

    Re: Populating drop down box in code

    You could probably do this easier with data filtering on the drop-down list.

    Either way you will have to populate the drop-down from a secondary data source, once this is done you could add/remove rows with code or use the better option of data filtering on the drop-down control.

    To add data filtering, click the "Filter Data" button when selecting what nodes to populate the drop-down with.

    I hope this helps, let us know if you have any questions.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 03-06-2006 07:33 PM In reply to

    • Carlos
    • Top 500 Contributor
    • Joined on 01-25-2006
    • Australia
    • Posts 31

    Re: Populating drop down box in code

    Thanks for your advice. I prefer to add code to remove rows displayed. I have an idea how to do this, but im seriously lacking vbscript skills to do this bit (remove rows from drop down list).

    Can someone please let me know what the code is to do this.

    Cheers,
  • 03-06-2006 10:42 PM In reply to

    Re: Populating drop down box in code

    There is a How-To written by Greg on how to populate dropdown from code
    http://www.infopathdev.com/howto/tutorials/default.aspx?i=987250af134b4ced85cbddc7db724202
  • 03-22-2006 08:03 AM In reply to

    Re: Populating drop down box in code

    I am in a related dilema. I have 2 drop down lists from a sds and when one of the values is chosen a filter is used to determine what is displayed in the other drop down list. This works great... BUT. If you select a item from the top drop down then choose one from the bottom drop down then go back and change the top to another one of its values. The bottom drop down's displayed value stays the same. Other words it doesn't perform the filtering again. If you click on the drop down it will show the proper choices but it doesn't clear the choice that shouldn't be there.

    In addition to this when trying to write a script I ran into the problem that both of these drop down lists are in a repeating section. So if I wanted the script to clear the displayed value in lower drop down box based on the top ones value I can't because from what I understand all the top drop down's variables are the same repeating section making them all referenced by the same variable.

    If anyone has ideas shoot them my way.
    Thanks!
    josh
  • 08-10-2006 02:49 PM In reply to

    Re: Populating drop down box in code

    Ah this is a very common scenario. To fix this you just need to add a rule on the top dropdown to set the value of the bottom dropdown's node to blank. Then every time the top dropdown changes the bottom one will be cleared out. Even in the repeating section using rules should properly maintain context and only clear the dropdown in that item.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.