textinput

How to prevent keypress two digits after a decimal number?

谁都会走 提交于 2019-12-20 19:46:07
问题 I have got a task to prevent keypress two digits after a decimal number. My jquery file is $(function(){ $('#name').bind('paste', function(){ var self = this; setTimeout(function() { if(!/^[a-zA-Z]+$/.test($(self).val())) $(self).val(''); }, 0); }); $('#salary').bind('paste', function(){ var self = this; setTimeout(function() { if(!/^\d*(\.\d{1,2})+$/.test($(self).val())) $(self).val(''); }, 0); }); $('.decimal').keyup(function(){ var val = $(this).val(); if(isNaN(val)){ val = val.replace(/[

Is there a way to disable the zoom feature on input fields in webview?

不想你离开。 提交于 2019-12-20 12:28:20
问题 When a user clicks in an input field or textarea, the application zooms in. Is there a simple way to disable it? Currently have the meta tag: meta name="viewport" content="width=device-width; height=device-height; initial-scale=1.0; maximum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi;" Everything looks great till I look at it on a device with Android 2.2 Specifically HTC Evo 4G . 回答1: I messed around with this alot. You have to have different solutions for different screen sizes

Kivy input values for simple calculations

[亡魂溺海] 提交于 2019-12-20 06:24:51
问题 I'm quite new to Kivy (started yesterday) and am trying to create a simple enough app that has input boxes for several values of height and area to calculate volumes. I cant find any working methods of doing this. So far all I have got is this: from kivy.app import App from kivy.lang import Builder from kivy.uix.screenmanager import ScreenManager, Screen Builder.load_string(""" <MenuScreen>: FloatLayout: Label: text: 'Please Select an Area to Work With:' pos: 230, 490 size_hint: .15, .05 font

How can I prevent letters inside a text element?

前提是你 提交于 2019-12-20 02:37:53
问题 I like to have an input with maximum length 3. These input value should be only numbers no letters. By referring to this post: why is <input type="number" maxlength="3"> not working in Safari? you can see that I can't use <input type="numbers"> So how can I prevent letters inside an text-input-element? 回答1: You can use jQuery. $("#myField").keyup(function() { $("#myField").val(this.value.match(/[0-9]*/)); }); 回答2: <script> function checkPattern(elem) { if(!elem.value.match('^' + elem

scrollview can't scroll when focus textinput react native

我的未来我决定 提交于 2019-12-20 01:59:08
问题 I have a TextInput inside a ScrollView. The scroll isn't working when the TextInput is on focus. This problem is only affecting Android. 回答1: setting <ScrollView keyboardShouldPersistTaps="always" in combination with the textInout component below (custom component that i created for text inputs to solve this issue) solved my problem: <TouchableOpacity activeOpacity={1} onPress={()=>this.input.focus()}> <View pointerEvents="none" <TextInput ref = {(input) => this.input = input} /> </View> <

Kivy 'object has no attribute' Error

那年仲夏 提交于 2019-12-19 12:01:54
问题 I'm new to python and Kivy programming so getting trouble and may be asking simple question here, but its a big hurdle for me now. I am developing a GUI with kivy. I have some TextInputs which get numeric value. after all text inputs , I have a 'OK' button which gets all value and process them. I'm getting error in calling the function from same class in .kv file. main.py file: # File name: jwelkreator.py import kivy kivy.require('1.7.0') from kivy.app import App from kivy.lang import Builder

Keeping caret position in a visible position in text input - firefox misbehaves

瘦欲@ 提交于 2019-12-19 09:02:39
问题 I'm toying with the idea for my text input box of clicking on a div containing a selection of "tags" to add meta content. My text input has a width of 35, but I want it to be able to overflow. I've searched and found methods to focus and position my caret at the end of the updated input content, and chrome and IE behave themselves and auto scroll to show the cursor in the visible area of the input box, but when the text input is full and overflows Firefox 3.0.7 leaves the correctly positioned

How to use select() to read input from keyboard in C

吃可爱长大的小学妹 提交于 2019-12-18 13:19:26
问题 I am trying to use select() to read keyboard input and I got stuck in that I do not know how to read from keyboard and use a file descriptor to do so. I've been told to use STDIN and STDIN_FILENO to approach this problem but I am still confused. How can I do it? 回答1: Youre question sounds a little confused. select() is used to block until input is available. But you do the actual reading with normal file-reading functions (like read , fread , fgetc , etc.). Here's a quick example. It blocks

How do you dynamically identify unknown delimiters in a data file?

…衆ロ難τιáo~ 提交于 2019-12-18 12:19:16
问题 I have three input data files. Each uses a different delimiter for the data contained therein. Data file one looks like this: apples | bananas | oranges | grapes data file two looks like this: quarter, dime, nickel, penny data file three looks like this: horse cow pig chicken goat (the change in the number of columns is also intentional) The thought I had was to count the number of non-alpha characters, and presume that the highest count was the separator character. However, the files with

Concurrent/Non-blocking console keyboard input

烂漫一生 提交于 2019-12-18 03:39:33
问题 I'm working on a MUD in java. I read player input every tick, but I'm using Scanner which uses blocking operations. I want to have non-blocking input. I've looked at the nio package which has a Selector class, but I'm not sure how to use it with regard to System.in . I figure I'll definitely need it once I'm running a server, but for now everything is offline. I've tried extending the main class from Applet and overriding keyDown , but that just meant input was no longer accepted after the