是否可以使用外部附件框架在 iPhone UIWebView 中填充 HTML 表单字段数据?
我有一个 iPhone 应用程序,我想将远程服务的 HTML 表单加载到 UIWebView 中,然后在使用“外部附件框架”从外部附件获取数据时填充该表单。现在数据是手工输入的。建议的流程是:
- 获取包含表单的 HTML 页面并将其放入 UIWebView
- 当数据可从外部附件获取时,填充表单字段
- 提交表单
是否可以通过从外部附件“注入”数据来完成此操作当从外部附件检索到所有必需的数据时,外部附件进入 UIWebView 吗?我似乎找不到任何关于如何使用外部附件框架来实现这一目标的好例子。
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:
- Fetch an HTML page containing a form and put it into a UIWebView
- When data becomes available from the external accessory, populate the form field(s)
- 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然我自己没有更改表单字段,但我认为您可以使用 UIWebView 的 stringByEvaluatingJavaScriptFromString: 方法来运行任意 JavaScript 来操作 DOM 并设置这些表单字段根据需要。
While I haven't mucked with changing form fields myself, I think you can use
UIWebView
'sstringByEvaluatingJavaScriptFromString:
method to run arbitrary JavaScript to manipulate the DOM and set those form fields as desired.