Programmatically changing Dropdown values - InfoPath Dev
in

InfoPath Dev

Programmatically changing Dropdown values

Last post 07-20-2007 02:00 PM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-19-2007 11:13 AM

    • skrile
    • Top 500 Contributor
    • Joined on 08-17-2006
    • USA
    • Posts 29

    Programmatically changing Dropdown values

    Well, in my quest for a fully translated InfoPath form, I've come upon another scenario that I need a little guidance with. 

     I have a dropdown on my form called <visit_type>.  This drop down has Four static values in it (it's not wired to a database or Sharepoint list). 

    I have another drop down on my page that gives the user a choice in language (English, French, etc.).

    Currently, I have code that when a user chooses a language, several labels on the form have their values updated (if you are interested, you can check the code out here).

    So, what I would like to do is add a section to my setTranslations() function that would loop through <visit_type> or if necessary destroy and re-create the drop down with the desired tranlsations (using the tranString() function).  Is this possible?  If so, how?

  • 07-19-2007 05:02 PM In reply to

    Re: Programmatically changing Dropdown values

    Make your drop-down be populated from a data source (rather than hard-coded values). Then your code will just remove all the nodes that are used as drop-down values, and replace them with new nodes. It's just XML DOM manipulation.
  • 07-20-2007 11:14 AM In reply to

    • skrile
    • Top 500 Contributor
    • Joined on 08-17-2006
    • USA
    • Posts 29

    Re: Programmatically changing Dropdown values

    Thanks for the reply Greg.  My problem here is that I have value pairs like (green/1, red/2, blue/3).  After messing about with changing these values programmatically - one based on the other - I finally gave up and went a different route.  Now, I have radio buttons (there were only three choices anyway) and put labels next to the buttons.  The labels are bound to my translation data so it acts like the rest of my solution.
  • 07-20-2007 02:00 PM In reply to

    Re: Programmatically changing Dropdown values

    That works too! Good job!
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.