Populating Text Box Depending on Selection from Drop Down - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Populating Text Box Depending on Selection from Drop Down

Last post 01-13-2010 09:04 AM by BPChris1. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-13-2010 07:58 AM

    Populating Text Box Depending on Selection from Drop Down


    Still working on same form, was able to solve previous problems around cascading drop downs, after days of trial and error.  New problem, hoping I can get some help with this one.  In my form, my user is to select a name from a dropdown listbox which is populated from a sharepoint list.  Based on which name is selected, I would like a "Phone Number" text box to be automatically populated from the same row in the same sharepoint list.  Found tutorial on this forum (http://infopathdev.com/howto/tutorials/default.aspx?i=9111ef580f95479890fc18fb2c5bac85), and trying to adapt it.  The problem I have is this, when creating the rule, I am using the following expression (appended to match the tutorial ): 

    xdXDocument:GetDOM("Contacts")/dfs:myFields/dfs:dataFields/dfs:Contacts/@Business_Phone [../ID = current () ]

    I am getting the following error message.

    "xdXDocument:GetDOM("Contacts")/dfs:myFields/dfs:dataFields/dfs:Contacts/ID" does not point to a valid location path of a field or group.

    The following portion of the expression is populated by infopath when I select the field in the add expression dialog box: 


    One question is this:

    Is ID used here an xml function or should I be entering something else. 

    Please help, last step to getting form working and really need to get it done.



    Filed under:
  • 01-13-2010 08:27 AM In reply to

    Re: Populating Text Box Depending on Selection from Drop Down

     ID is the name of a node in the data source that uniquely identifies each row of data (you can see that each <Client> element in the tutorial has an <ID> child element).  Does your data source have anything like that?  If so, replace ID with that.  Judging from the XPath right now, it will probably be an attribute, not an element, so remember to place an @ before its name.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-13-2010 09:04 AM In reply to

    Re: Populating Text Box Depending on Selection from Drop Down


    I got it figured out using another expample that I found on the forum which was a link to http://www.bizsupportonline.net/infopath2003/autofill-fields-infopath-dropdown-selection-secondary-data-source.htm.

    This example did not work exactly though.  If I understand this at all, the problem that I have is that sharepoint delivers a flat data source.  (Although the list items have a unique identifier, the other elements are not chlild elements of that ID element.)  I was able to adapt this example though, by changing the field selected in step 14 to the field in the secondary data source to which my dropdown was bound.  In this case the field value in the add action dialog became:"@Business_Phone[@Last_Name = Name]", where "Name" is the drop down box, and "Last_Name: is the field in the secondary data source.  I never reference "ID".  I suspect that another issue with the previous example (and I could be wrong as I am a newbie) is that in reading the help file, it appears as though the "current" function only works with repeating elements, and in my case the drop down box is not a repeating element.  Any thoughts?




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