views:

239

answers:

2

Hey All,

Okay, so I have an iphone app that presents the user with a UIWebview of an html page with a form I created. The form has standard stuff like a message box and dropdown boxes. Once the user fills out the form and clicks submit, it saves the information as nsstrings in my program. Okay, no problem there. That all works fine.

However, I also wanna be able to edit this form as well. Once I save all this information the user selected in the form (as strings), is there a way to put it back into an html form using an uiwebview so a user of the app can edit the info later on?? I apologize in advance if I didn't give enough info.

+1  A: 

You can do this with javascript. Just create a javascript snippet to fill in the fields, and execute it using -[UIWebView stringByEvaluatingJavaScriptFromString:].

Ben Gottlieb
A: 

yea, i have been trying to do this..but just haven't had luck. To pull the info, I do this:

NSString *message = [webView2 stringByEvaluatingJavaScriptFromString: @"document.formNotification.messageArea.value"];

So to fill in the fields, I tried:

[webView2 stringByEvaluatingJavaScriptFromString: @"document.formNotification.messageArea.value = 'whatever'"];

However, that didn't seem to fill it in. Now I don't know that much in terms of JavaScript. I have searched all over to try to figure out how to do things but haven't had much luck yet.