Infopath 2010: Populate fields when a user inputs a value in one field - InfoPath Dev
in

InfoPath Dev

Infopath 2010: Populate fields when a user inputs a value in one field

Last post 07-17-2012 08:13 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-16-2012 10:18 AM

    Infopath 2010: Populate fields when a user inputs a value in one field

    I just started learning InfoPath and have some basic questions. I m hoping that I will get some good guidance .

    I created a blank InfoPath form using InfoPath Designer 2010. I have four text boxes for testing purpose. LEt's say I have these fields.

    • ID
    • First Name
    • Last Name
    • Email

    I have a SQL Server database and a table with those above fields and values for those fields.

    Now I want to get the following result:

    When I type in ID and hit enter,I should get all the other textboxes populated with the values from my database for that ID.

    How do I do it in InfoPath 2010? I can do it using database template or a WCF service template. These templates automatically add Query button which upon clicking, give me the data i want in all other textboxes  but I don't want the button action. Instead I want the fields to be populated depending upon what value I type in ID textbox and hit enter key. Please kindly help me with this. Thanks.

  • 07-16-2012 04:04 PM In reply to

    Re: Infopath 2010: Populate fields when a user inputs a value in one field

    Is your intent to use a database bound template? If so, you can put the ID query field (your data source will have both query and data fields) on the form, have the user type in the ID and have a rule on that field that runs the query.

    If your intent is to not use a database bound template, you'll probably want a web service that you can use to only get the data from the DB related to the entered user ID, so you don't have to load all the data - we sell a really nice one here. In that case, you'd have a main data source field on the form the user can enter an ID into, and whatever rules you need to query your data on that field.

    If your intent is to just load all the data from SQL and then use filtered XPath to set field values, you can do that too - but you'll see some performance hit unless your table is small.

    The general idea for all these is the same - your rules need to be on the field where the user enters the ID.

    Hilary Stoupa

  • 07-16-2012 06:45 PM In reply to

    Re: Infopath 2010: Populate fields when a user inputs a value in one field

    Hi Hilary, Thanks for your reply. I was waiting eagerly for an answer since this is my first post in this forum and being a new bie in IP world, I m curious to learn as much as I can. I tried a couple of things. 1.) As you suggested, used a database template and got query field, data field, Run Query button. I got the result I wanted on hitting the Run Query button. 2.) Created a web service and created browser based web service IP Form to consume the web service. It also gives me the result on my data fields based on the value i input into query field and on hitting Run Query button. What I really want to see is what is there's a blank template form w/o any Run Query button. In that case I want to see if I input NT ID in first textbox and hit enter key, then rest of the text boxes should fill in the values related to that NTID. Of course I want to make use of my web service in this IP form. Being a beginner, I m not finding a way to do that. As you suggested, I need rules to be on the NTID field where user enters the ID, could you shed some light on how to do it...May be this is easier way to do that what I thought. I thought of using InfoPath's textbox event and writing some sort of code to pass the value of NTID to my web service(though right now I don't know HOW can I do that or can I do that at first place?) It seems ChangedContext event for NTID textbox is a good fit however that event is not available for a browser based IP form. So I m clueless on what should be my appropriate steps to solve my problem. Please kindly help me/guide me. Your help will be greatly appreciated. Thanks again.
  • 07-17-2012 08:13 AM In reply to

    Re: Infopath 2010: Populate fields when a user inputs a value in one field

    Simply select the NTID field in the data source task pane (or a control bound to it on the form) and then select Manage Rules from the Ribbon to add rules to it.

    If your web service that you created has query parameters that take the NTID value, you could add a rule to set the query param field to the value of the field, then run the query via the rules.

    Hilary Stoupa

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