Summary
Suppose you want to have the items listed in a drop-down be dependent on the selection of another drop-down (this is also known as "cascading dropdowns). If you have InfoPath Service Pack 1 installed, you could use the "Filter Data..." feature to accomplish this.
Example
You have one drop down labeled "State:" with the names of states and another drop-down labeled "City:" which gets populated with the names of the cities for the state you selected on the previous drop down.
The city drop-down obtains its values from an xml file which might look something like this:<Cities> <City state="Washington">Redmond</City> <City state="Washington">Seattle</City> <City state="California">Los Angeles</City> <City state="Florida">Orlando</City></Cities>
Implementation
Additional Notes/Tips
For the two above comments: in InfoPath 2003, you need to employ an XPath current() function, described in this article:
http://blogs.msdn.com/infopath/archive/2004/09/13/228881.aspx
InfoPath 2007 will do this for you.
Thanks,
- Alex
I have created an InfoPath form and have a specific field linked to another site via a data connection from where I collect a set of alphanumerical codes (ex: WTR001A, GDL542B). I want to semi filter the codes. I don’t want to sort them alphabetically for now, just worry about filtering the options upon selection of a specific building location.
My 1st filter field asks the user to select a building location which are:
• AMS = Americas
• BA = Buenos Aires
• BCN = Barcelona
• Etc.
Upon the user’s selection I want the “codes” mentioned above to display only the ones pertaining to that building location. Perhaps having a XML file that specifies if a user selects Barcelona, then only show BCNXXX “codes” if a user select Singapore, then only SGPXXX codes show
Would an XML file work? If so how would it look like?
Thank you man that was a good article
how do I create the xml the city drop down obtain its values from?
I do this 'filter' and it returns only 1 row in the drop down, while it should return 4 or 5 different values in the dropdown.
PS: using Infopath 2010.