0

I have web forms built in Zoho that have text inputs as well as drop down selections. Using the Javascript console in Chrome, I've figured out which commands I need to use to isolate those components. My issue now is this - I want to natively style and implement UITextViews for those text inputs. How can I link text that the user types into those views with text in those areas of input on the webform?

After looking around, I think that this is something along the lines of what I need:

NSString *string = [NSString stringWithFormat:@"document.getElementsByTagName('INPUT')[1].value = %@", textView.text];
[webView stringByEvaluatingJavaScriptFromString:string];

But, this wasn't working. Am I missing something or is this just not doable?

Quikdart
  • 53
  • 2
  • 7
  • instead of calling `document.getElementsByTagName('INPUT')[1].value = %@` try creating a javascript function which does the same and call the function from iOS. Also make sure you are getting correct input – Bluewings Aug 20 '15 at 02:49
  • Do you mean by using JavaScriptCore? Can you show me an example of what that might look like? Would I just pass the webView to the function as document? – Quikdart Aug 20 '15 at 06:01
  • yup just write a JS function to get the textview text and set the value to your input and call the function from iOS using `stringByEvaluatingJavaScriptFromString` – Bluewings Aug 20 '15 at 06:18
  • check [this](http://stackoverflow.com/questions/7719881/can-you-call-a-javascript-function-from-native-code-not-in-a-callback-using-ph) SO answer for calling function with parameter – Bluewings Aug 20 '15 at 06:19

0 Answers0