Input bug?

72 views
Skip to first unread message

Kalle Alm

unread,
Jul 4, 2007, 9:34:03 AM7/4/07
to iphone...@googlegroups.com
I haven't seen anyone else mention this, but is the iPhone bugged when
you input data, submit, and then try to input again?

E.g. a text field in AJAX forms, like a chat app or such. Typing text
the first time works fine, submitting works fine, but trying to type
after that doesn't seem to actually send the input to the field. The
keyboard buttons work though.

Example: http://enrogue.com/lace/

Select the bottom input box, type something, "Go", try to type somehing
else. Anyone (not) getting that bug?

-Kalle.

Xenon

unread,
Jul 4, 2007, 12:08:31 PM7/4/07
to iPhoneWebDev
Yes, I have seen this bug too while working on the Colloquy web
interface.

The workaround is to do this:

document.execCommand("selectAll");
document.execCommand("delete");

Instead of:

input.value = "";

Note, this workaround only works if your input already has focus. Also
note the focus() and blur() do nothing on the phone.

Hardy Macia

unread,
Jul 4, 2007, 12:07:41 PM7/4/07
to iphone...@googlegroups.com
I have to tap in the input lone again before I can type second time,

Hardy

Sent from my iPhone

Kalle Alm

unread,
Jul 4, 2007, 2:33:36 PM7/4/07
to iphone...@googlegroups.com
Xenon wrote:
> Yes, I have seen this bug too while working on the Colloquy web
> interface.
>
> The workaround is to do this:
>
> document.execCommand("selectAll");
> document.execCommand("delete");
>
> Instead of:
>
> input.value = "";

Thank you very much for that fix! To make it work in "other browsers" as
well as the iPod, my complete fix looks as follows:

// Clear field value
try {
// iPhone whilst-focusing way


document.execCommand("selectAll");
document.execCommand("delete");

} catch (e) {}
// Other browsers' way + iPhone when not focused
this.textObj.blur();
this.textObj.value='';
this.textObj.focus();

Where this.textObj points to the text input field.

> Note, this workaround only works if your input already has focus. Also
> note the focus() and blur() do nothing on the phone.

With the way above, it clears the input box in all cases, in all
browsers (well, I didn't test IE cause I'm in linux, but it works in
Firefox, Safari 3, and on the iPhone).

Thanks again. :)

-Kalle.

Christopher Allen

unread,
Jul 4, 2007, 4:11:47 PM7/4/07
to iphone...@googlegroups.com
On 7/4/07, Kalle Alm <kall...@gmail.com> wrote:
> Xenon wrote:
> > Yes, I have seen this bug too while working on the Colloquy web
> > interface.
>
> Thank you very much for that fix! To make it work in "other browsers" as
> well as the iPod, my complete fix looks as follows:

You should consider posting some html that demonstrates the bug, and
send the workaround, to Apple's RADAR bug reporter.

-- Christopher Alln

Kalle Alm

unread,
Jul 5, 2007, 11:20:47 AM7/5/07
to iphone...@googlegroups.com
Done. Problem ID is 5313789.
-----------------------------------
05-Jul-2007 04:26 PM Karl-Johan Alm:
Summary:
In web pages where a text field input works sort of like a chat, in that
the user is expected to type something, send, type something more, send,
etc., the iPhone keyboard ceases to function after the first send,
unless the input form element is re-visited. The keyboard is there and
tapping the keys appear to work but no input appears in the form field.

Steps to Reproduce:
- Create a web page with a form and a text input element.
- Set the onsubmit handler to reset the input field's contents (to '').
- Load the page on an iPhone.
- Type something into the field and "send".
- Try typing something else after the text you previously typed has been
cleared.

Expected Results:
The keyboard is expected to continue being able to provide text to the
input field.

Actual Results:
The keyboard does not function as expected.

Regression:
The following workaround fixes this bug;
Replace:
input.value=''
With:


document.execCommand("selectAll");
document.execCommand("delete");

The following workaround fixes this bug and remains compatible with
other major browsers:

// Clear field value
try {
// iPhone whilst-focusing way
document.execCommand("selectAll");
document.execCommand("delete");
} catch (e) {}
// Other browsers' way + iPhone when not focused
this.textObj.blur();
this.textObj.value='';
this.textObj.focus();

Where this.textObj points to the text input field.

Notes:
The problem can be observed here: http://enrogue.com/lace-broken/
The solved version of the above problem can be observed here:
http://enrogue.com/lace/
-----------------------------------

-Kalle.

Reply all
Reply to author
Forward
0 new messages