Hi,
I'm developing a form using Infopath 2007 (Beta) to be used in Sharepoint 2007 and have a query regarding validating a field against a web service data source. I should also point out I'm new to developing in Infopath so I may have missed something obvious.
The scenario is this:
I have a form with three controls (it actually has a lot more but three is enough to demonstrate the issue).
The controls are:
i) Textbox for customer ID
ii) Read Only Textbox showing the customer name.
iii) Button to lookup customers
The form needs to provide a lookup via a web service to return the customer name for a given id. It needs to provide two ways of achieving this.
The first uses the button to change to a different view where the user can enter either an ID or a partial name and get a selection of matching customers to choose from. This works fine, I've set up a secondary data source to the web service and the form creates a repeated set of matching results for the user to choose from.
The second approach is to allow the user to enter the customer ID directly into the textbox. In order to do this I need the textbox to be validated by calling the web service and the customer name updated or an error raised. I couldn't see how to perform this using validation rules so I've chosen to perform it in code. I thought my validation code would be quite simple: move the value of the customer ID to the field in the secondary data source, execute the web service and move results back to the main data source. Unfortunately I've found I cannot write the customer ID to the secondary data source as the data source cannot be editted at this point.
Has anyone else used Infopath in this way and am I doing something wrong? Any help would be appreciated.
Thanks
Chris