I have a website that is optimized to work on iOS devices. But the problem is that the keyboard always says Go as user fills the form. How do I get the keyboard to say Next until the last entry on the form, where it should say Go? Or alternatively, how do I disable the Enter button entirely?
Again, this is a website. It works everywhere websites work: in browsers. Except I have having this particular problem in Safari on mobile devices.
while changing the input type gives you some control of the keyboard layout the return key label in IOS cannot be customized.
Other than changing it to say Search there are no customizations available. You can disable the functionality of the button using something like this injQuery:
$("#myForm input").live("keyup", function(evt) {
if (evt.keyCode === 13) {
$("#myForm").trigger("submit");
}
});
Related
I am currently working on Wes Bos' JavaScript 30 project, and in this drumkit project, I was hoping to add to his finished code by allowing user to click on the button rather than only through 'keydown' event.
After adding to the playSound function to detect
event.path[1].dataset.key || event.path[0].dataset.key
so that the click event would be able to grab the button's attribute, which contains the keyCode, and use that to detect which audio to play. Then I wrote this:
window.addEventListener('click', playSound);
and it worked great on desktop, it also worked great on my android smart phone, but for some reason the button doesn't work on an iphone.
So after looking through some similar results on stackoverflow, here's what I've tried:
window.addEventListener('touchstart', playSound)
and
window.addEventListener('DOMContentLoaded', (event) => {
window.addEventListener('touchstart', playSound)
});
but neither of them seems to work on iphone. Is there something special about iphone that doesn't allow me to click a button using their touch screen? Android doesn't seems to have this issue at all.
it turns out all i needed to do is use document.addEventListener instead of window.addEventListener for iOS
I've taken over the work on an iOS app, I've managed to work quite well with it thus far adding new functionality despite not being a trained iOS developer. However I've hit a patch where I simply cannot get the keyboard to show on screen when I tap on a UITextfield, there are areas of the app where it works but any new areas I add this simply will not work. Is there a standard bit of code that controls showing the keyboard when you tap a text field?
Need help
Keyboard opens up automatically unless you forced to not open.
You can check following, See screenshots.
Enable is checked
User Interaction Enable is checked
If you are checking on simulator try “command + k” from keypad
textFieldShouldBeginEditing delegate returns TRUE
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
return TRUE;
}
Are you running on a simulator or a real device?
I'm working on a NativeScript-Angular app for both Android and iOS but have hit a problem with standard back button navigation. I have resolved the issue for Android, but cannot find a solution for iOS.
The event is causing a problem when going back to a particular page where routing data is expected, resulting in the exception:
"Error: Currently in page back navigation - component should be reattached instead of activated".
My Android solution catches the back button event and cancels it, then calls the router to do the navigation.
ngOnInit() {
if (app.android) {
app.android.on(app.AndroidApplication.activityBackPressedEvent,
(args: any) => this.backEvent(args));
}
}
backEvent(args) {
args.cancel = true;
this.backToRegister(false);
}
backToRegister(accepted: boolean){
this.router.navigate(['/register',
this.registerParametersEntered.password,
this.registerParametersEntered.confirmPassword,
this.registerParametersEntered.code,
this.registerParametersEntered.email,
accepted]);
}
I want to do something similar with iOS, such as: -
if (app.ios) {
this.page.on('navigatingFrom', (data) => {
// TODO cancel the back button event
this.backToRegister(false);
})
}
I can't find a way of doing this for iOS - my research is leading me to the conclusion it is not possible to cancel the iOS back button - for example, see here.
Any ideas or alternative suggestions greatly appreciated!
You can't override the back button for iOS. See this SO question. You basically need to create a custom button, you can mimic the appearance of the back button on iOS and add your own event handler. That's how you'd do it in a native iOS app, and how you do it in NativeScript since the native controls are used via NativeScript.
The actionbar in nativescript can have a custom layout inside or you can just use an action-item and position it on the left for iOS, while also hiding the button on Android if you desire.
Another solution would be, instead of catching the back button event just to throw it away/disable it - to just clear the history after you are switching a page where there no "back" to go to.
this.router.navigate(['level1'], {
clearHistory: true
}
I want to keep the keyboard displayed at the bottom by default without using a text input which the user needs to tap.
I need to keep the keyboard at the bottom at all times.
Then I need to listen to the events of the keyboard.
How can I do this?
The workaround I implemented was adding an invisible text box somewhere on the screen and then set it as focused manually.
Just in case someone else might stumble upon this, OP's self answer works. In order to set focus manually, you'll need to get the ref to the hidden input.
<TextInput
ref={input => (this.textinput = input)}
style={{ display: 'none' }}
/>
then elsewhere in the code, you focus manually by
if (this.textinput) {
this.textinput.focus();
}
This answer is way too late to do the OP any good, but for others:
You can't do this. In iOS, the operating system, keyboards simply don't/can't work this way. iOS never shows a keyboard without an active text input focus, and there is no way for even a native iOS app to override this OS-level behavior. The OS itself prevents this from happening.
I use an app called "Slack" somehow they managed to change the return key to be "#" and "#" like in the picture.
I really don't know whether they created a whole new keyboard view that look exactly the same as iOS default keyboard or
It has a way to custom the return button of the default keyboard.
Anyone got any idea how can they do this on iOS 7?
Slack has shared it source code for handle message like app here
Which I still cannot locate where is the functionality to add "#" and "#"
You can achieve this by using the Twitter keyboard built in to the iOS SDK.
[textField setKeyboardType:UIKeyboardTypeTwitter];
If you're using Interface Builder, select your UITextField and go to the Attributes inspector -> Keyboard Type -> Twitter.