What's a good way to prepopulate web form fields with data from an external database? What might be a sane approach to prepopulating web form fields using data from an external database on the fly? This is my scenario: there is a form that we need clients to fill out, but we already have a lot of the client's information in our database. So to make it easier on the client, we want to fill out the form as much as possible before sending it to them to fill out the rest. I'm using the webform module on our Drupal 7 site, but all the data needs to come from our other database.
Ideally, there would be either a page or just a field where I can select the client ID. After choosing the client ID, other fields would use that ID to pull information like contact name, address, etc.
Is there a reasonable way to do this?
You would need to expose an API from your external database. If the external database is also a Drupal 7 site, you could use the RestWS module to do this (https://www.drupal.org/project/restws).

Once you have your data exposed via api, you would then have to connect to the api on the client's site, and you could auto populate some hidden fields via an ajax call when they select the ID. You would want to do this in a custom module.