iPhone Keyboard Dismiss

41 views
Skip to first unread message

sanford

unread,
Sep 10, 2007, 12:06:03 PM9/10/07
to iPhoneWebDev
Hello,

I have a <form> with two input objects: a field and a button.

When the form is submitte a javascript:function() is executed and
the same document's DOM is modified via JavaScript's appendChild().

- If the user manually pushes the "OK" button the keyboard goes away
correctly.

- If the user types a return on the keyboard, the form is submitted,
but the keyboard sticks around and isn't dismissed.

The form/javascript does _not_ forward the user to another page or
load any data from a server. It merely modifies the DOM in-place.

How do I get the keyboard to go away after the user submits the form
with the keyboard? I've tried to "blur()" the input field to remove
it from focus, but this did not work.

Thanks,
Sanford

Snyke

unread,
Sep 11, 2007, 4:15:49 PM9/11/07
to iPhoneWebDev
That's a really interesting question, and I was going asking a similar
thing so I'll just put it here:
Is there a way to tell the iPhone that a textfield accepts only
numeric values so it displays the numeric keyboard immediately?

Regards,
Christian Decker
--
http://snyke.net/blog

Erwin Harte

unread,
Sep 11, 2007, 6:19:24 PM9/11/07
to iphone...@googlegroups.com
Snyke wrote:
> That's a really interesting question, and I was going asking a similar
> thing so I'll just put it here:
> Is there a way to tell the iPhone that a textfield accepts only
> numeric values so it displays the numeric keyboard immediately?

If your input field's name contains "phone", it'll give you a typical numeric
keypad, if the input field's name contains "zip" it'll start with the regular
keyboard in numeric mode.

http://www.iphonewebdev.com/faq.shtml

Hope that helps,

Erwin.

dannyg

unread,
Sep 12, 2007, 12:06:09 AM9/12/07
to iPhoneWebDev
On Sep 11, 3:19 pm, Erwin Harte <ha...@skotos.net> wrote:
>
> If your input field's name contains "phone", it'll give you a typical numeric
> keypad, if the input field's name contains "zip" it'll start with the regular
> keyboard in numeric mode.
>

My dream is an implementation of Web Forms 2.0, which allows the
developer to be more specific about input type...including date and
time fields that could (hint, hint) bring up the kind of control we
get when setting an appointment in the Calendar app.

Danny
http://dannyg.com
http://spamwars.com

sci...@gmail.com

unread,
Sep 11, 2007, 10:46:32 PM9/11/07
to iPhoneWebDev
Oh, but the real question is, How do you disable the spell check?

BJ Clark
bjc...@scidept.com

Snyke

unread,
Sep 13, 2007, 10:26:38 PM9/13/07
to iPhoneWebDev
Wow, that's pretty restrictive isn't it?
--
http://snyke.net/blog/

Chris

unread,
Sep 19, 2007, 1:09:51 AM9/19/07
to iPhoneWebDev
Having the same problem and about to throw in the towel.
This is a major impediment to developing AJAX apps.
Did you ever have any luck finding a solution?

On Sep 10, 12:06 pm, sanford <shselzn...@gmail.com> wrote:
> Hello,
>
> I have a <form> with two input objects: a field and a button.
>
> When the form is submitte a javascript:function() is executed and
> the same document's DOM is modified via JavaScript's appendChild().
>

> - If the user manually pushes the "OK" button thekeyboardgoes away
> correctly.
>
> - If the user types a return on thekeyboard, the form is submitted,
> but thekeyboardsticks around and isn't dismissed.


>
> The form/javascript does _not_ forward the user to another page or
> load any data from a server. It merely modifies the DOM in-place.
>

> How do I get thekeyboardto go away after the user submits the form
> with thekeyboard? I've tried to "blur()" the input field to remove

Randy Walker

unread,
Sep 20, 2007, 2:38:14 PM9/20/07
to iphone...@googlegroups.com
I would file a bug report if I were you. Hitting return in a text
area should result in a new line in the box, and have the keyboard
stay open for more typing. Hitting return on any other form element
should submit the form, but also close the keyboard.

-=Randy

Kevin Darling

unread,
Sep 20, 2007, 10:21:26 PM9/20/07
to iPhoneWebDev
On Sep 10, 12:06 pm, sanford <shselzn...@gmail.com> wrote:
> When the form is submitte a javascript:function() is executed and
> the same document's DOM is modified via JavaScript's appendChild().

I have not tried this, but your " javascript:function() " caught my
eye.

Do you really use that kind of function call, and if so, where?
Please post your simple form.

Javascript: has a special meaning... it is supposed to return HTML
code. Many misuse this of course, but the browser will often do
totally unexpected things because it's in a different mode (expecting
to see new HTML returned from the javascript: call) than in a form
submit.

Always let a form submit call a function and then cancel the submit
yourself in the usual ways.

Sanford Selznick

unread,
Sep 20, 2007, 12:52:47 AM9/20/07
to iphone...@googlegroups.com
No, unfortunately. I did submit it as a bug to Apple, though.

Best,
Sanford

Sanford Selznick

unread,
Sep 20, 2007, 12:52:47 AM9/20/07
to iphone...@googlegroups.com
No, unfortunately. I did submit it as a bug to Apple, though.

Best,
Sanford

At 5:09 AM +0000 9/19/07, Chris wrote:

Reply all
Reply to author
Forward
0 new messages