Re: UIWebView not updating picker when picking dynamically populated select items
Re: UIWebView not updating picker when picking dynamically populated select items
- Subject: Re: UIWebView not updating picker when picking dynamically populated select items
- From: Ron Wagner <email@hidden>
- Date: Wed, 05 Oct 2011 16:01:27 -0400
On Oct 5, 2011, at 3:28 PM, Conrad Shultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 10/5/11 12:04 PM, Ron Wagner wrote:
>> I have an app with a UIWebView. The contents of the UIWebView
>> contains two html <select> items. When the first select item is
>> changed, javascript on that <select> item populates the second
>> <select> time according to the selection of the first <select>
>> item.
>>
>> The problem I am experiencing is that when tapping on the first
>> <select> item, Safari brings up a Picker for the <select> item,
>> along with a view above the Picker containing Previous and Next
>> buttons. When clicking on the Next button, the Picker stays in
>> place and the second <select> item is focused, but the Picker
>> doesn't update to display the newly updated contents of the second
>> <select> item, which was populated by the first <select> item's
>> onChange javascript.
>>
>> I am about to file a bug report against WebKit for this, but am
>> looking for a workaround. I realize that this might be more of a
>> Safari list question, but since it is in an app using a UIWebView
>> I'm willing to attack it from either side if anyone has any ideas.
>
> There are undoubtedly people on the list (and elsewhere) far more
> skilled than I in these sorts of issues, but I'll throw out a couple
> naive ideas.
>
> I presume that you have otherwise tested this behavior and that the
> problem only manifests when "Next" is used (instead of tapping on the
> page body, thus resigning first responder)? If so, that does rather
> sound like a WebKit bug. (I'm also assuming that you meant
> "UIWebView" instead of "Safari" in your message.)
Yes I have tested by clicking on the second select directly, no change. I did mean UIWebView, but Safari slipped because I've also been testing in Safari on the iPhone to make sure it wasn't my app that was adding some unintended behavior into the mix. Unfortunately Safari and my app have the same behavior with this problem.
>
> As a workaround, maybe try using a different event. Instead of
> "onchange" (note: event names are technically supposed to be
> non-camel-cased: http://www.w3.org/TR/html4/interact/scripts.html),
> what happens if you use "onblur" on the first <select> or "onfocus" on
> the second <select>?
Had tried the onblur on the first select but not onfocus on the second. Unfortunately no change in behavior.
Re non-camel-case, I checked my code and they were correctly cased (thanks Dreamweaver), but thank you for pointing that out.
>
> It might also help (for your bug report if no other reason) to
> determine whether the issue is WebKit failing to trigger the
> "onchange" event or the second <select> failing to honor the change.
> If you through in an alert() or equivalent into your "onchange" code
> it should be pretty easy to distinguish. If the problem is <select>
> failing to honor the change, you might be SOL (or at least would have
> to find some more convoluted approach that does trigger an update).
I can see the actual select item on the web page changing when it should. The problem is that the Picker items aren't changing along with the select item. I've tried a hack to un-focus the second select and then re-focus it, but when I re-focus it I can see the select item focused, but the Picker doesn't come back up. When hitting the next button or directly clicking on the second select, the Picker stays up but doesn't update it's items.
Thanks for your suggestions
Ron Wagner
>
>
> - --
> Conrad Shultz
>
> Synthetiq Solutions
> www.synthetiqsolutions.com
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden