views:

403

answers:

1

Hi All, I'm trying to embed a WebView inside a UIView/TableView so as to implement the combobox. The WebView will have the select element , after the selection the value should be returned to the main UIView. I'm not sure how to implement this.

In the ViewDidFinishLoad, I try to run the JavaScript like this:

- (void)webViewDidFinishLoad:(UIWebView *)aWebView {<pre>
    if (initialLoad) {
     initialLoad = NO;//NO initially
    }
    NSString *scriptCode = @"var selectmenu=document.getElementById(\"mymenu\"); selectmenu.onchange= this.options[this.selectedIndex].value; ";
    NSString *translatable = [webLoader stringByEvaluatingJavaScriptFromString:scriptCode];
    NSLog(@"isTranslatable: %@", translatable);
}

This is not working...! Could someone please tell me how to do it....? Thanks

+1  A: 

I'm not exactly sure what you are trying to do, but embedding a web view in a table view to implement a combobox sounds like "ur doin it rong"…

Jonathan Sterling
What is the correct way to do it? Any suggestions anyone?What I want is to implement a combobox or a dropdownlist in a UIView. When the user selects a particular value, I would like to know what value was selected. How to do this?
Neeraj
I think the following should work: when the cell is selected, have it open a UIActionSheet with a UIPicker embedded in it. Then, implement UIPickerDelegate to find out which value was selected.As for a checkbox, the iPhone doesn't really use those. You should use a UISwitch embedded in a custom UITableViewCell.There are plenty of resources for both tasks here on Stack Overflow.
Jonathan Sterling