This is a migrated thread and some comments may be shown as answers.

iOS keyboard "go" button

6 Answers 371 Views
Report a bug
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kevin
Top achievements
Rank 1
Kevin asked on 22 Apr 2013, 04:26 PM
How can I utilize this button?

I have a form that has a .submit method and i have a button on my page that has a click event that calls the form.submit(). this all works great but for some reason I can not get the "go" button to do anything at all.

I looked at the airlines example app that seems to have this behavior but can not find anything different in it... kind of lost here as to why mine is not working. anybody have any ideas?

6 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 23 Apr 2013, 11:42 AM
Hi Kevin,

The behavior you describe is handled by the UIWebView itself and we do not have any control over this i.e. we haven't done anything special for the sample app you talk about. Check your html markup and verify it is valid, as this is a possible culprit.

Kind regards,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Kendo UI Dojo.
0
Kevin
Top achievements
Rank 1
answered on 23 Apr 2013, 02:48 PM
Unfortunately in this case it doesn't seem to be the cause. I ran my markup through w3c markup validator and the only error that comes back is from the "switch" input element not having a type. (This is how the kendo UI demo shows it used properly, and for kicks i removed the switch input completely, no change in functionality regarding the go button)

http://demos.kendoui.com/mobile/switch/index.html#/

Nothing else is coming up =(

*update: as a followup. i added an alert inside the submit event (and yes i have return false in there as i found similar problems that were solved in this way.. but it didnt fix it for me).... it never triggers the alert with the go button. just nothing happens at all. but the normal submit button on the page works just fine.
0
Steve
Telerik team
answered on 23 Apr 2013, 03:42 PM
Hi Kevin,

A quick search shows that you need <input type="submit"> in order for the Go button to work as submit. Please double check whether you have specified type or you're not using hyperlink instead.

Greetings,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Kendo UI Dojo.
0
Kevin
Top achievements
Rank 1
answered on 23 Apr 2013, 03:44 PM
I am using an input type = "submit" i already double checked that one as well. =\

Interestingly enough, i also went down the path of removing the form tag entirely and the go button switches to a "return" button. I'm fine with this, i'd just have to manually construct my form.serialize.... unfortunately the "return" button fails to work as well. tapping it does absolutely nothing.... i'd expect it would close the keyboard, but it does not
0
Kevin
Top achievements
Rank 1
answered on 23 Apr 2013, 03:52 PM
I figured it out!

I had originally used an <a> button for the submit. with some custom styling and what not.

<a data-role="button" data-click="debtApp.clickEvents.saveProfile" id="save-profile" name="save-profile" class="km-button" style="text-align: center; margin: 0px 1% 5px 1%; padding: 15px 0px 15px 0px; width: 98%; font-size: 1.6em; font-weight: bold;">Save Changes</a>

changed it to input type="submit" and no change...

what ended up working was switching it back to the a tag and instead putting a bare bones submit button hidden on the page before it.

<input type="submit" style="visiblity: hidden; position: absolute;/>

now everything is working peachy!

**update: however the keyboard fails to close... hmmm 

fixed it by adding a $("input").blur(); at the end of the submit function. yay
0
David
Top achievements
Rank 1
answered on 01 May 2013, 03:32 PM
I struggled with getting the submit functionality to work as well but in the end I found that I was over complicating the issue.  In my case I didn't need a 'submit' I needed the input to respond to the 'go' key (keyCode 13) and perform the same action as though one of my buttons had been clicked (that is instead of 'clicking' the button, just call the method that click is bound to on the view model).

In my case on the login page I wanted the go key to trigger the login method on my view model.  You can do that like so:

  $("#login input").keyup(function(e) { //inputs on login view should call vm.login method on 'enter'
     if(e.keyCode === 13) {
      vm.login(); 
        $(this).blur(); //iOS likes to keep the keyboard open ... so remove focus to close it
      }
   });

This could probably be made to be more generic and dynamically wire this up based on some data-attribute on a view but the code is so simple and I only needed it on 2 views so I just left it like that.
Tags
Report a bug
Asked by
Kevin
Top achievements
Rank 1
Answers by
Steve
Telerik team
Kevin
Top achievements
Rank 1
David
Top achievements
Rank 1
Share this question
or