views:

158

answers:

1

I have an iPhone app where I'd like to load a remotely served HTML form into a UIWebView and then populate that form as data becomes available from an external accessory using the "External Accessory Framework." Right now the data is entered by hand. The proposed flow is:

  1. Fetch an HTML page containing a form and put it into a UIWebView
  2. When data becomes available from the external accessory, populate the form field(s)
  3. Submit the form

Is it possible to do this by "injecting" data from the external accessory into the UIWebView when all required data has been retrieved from the external accessory? I cannot seem to find any good examples on how to use the external accessory framework to achieve this.

A: 

While I haven't mucked with changing form fields myself, I think you can use UIWebView's stringByEvaluatingJavaScriptFromString: method to run arbitrary JavaScript to manipulate the DOM and set those form fields as desired.

Shaggy Frog