Questions tagged [textfield]
A text field (or text box) is a user-interface control allowing the user to input text into a program.
textfield
5,076
questions
451
votes
16
answers
370k
views
jQuery Set Cursor Position in Text Area
How do you set the cursor position in a text field using jQuery? I've got a text field with content, and I want the users cursor to be positioned at a certain offset when they focus on the field. ...
428
votes
28
answers
509k
views
How to create number input field in Flutter?
I'm unable to find a way to create an input field in Flutter that would open up a numeric keyboard and should take numeric input only. Is this possible with Flutter material widgets? Some GitHub ...
375
votes
20
answers
325k
views
How do I supply an initial value to a text field?
I'd like to supply an initial value to a text field and redraw it with an empty value to clear the text. What's the best approach to do that with Flutter's APIs?
325
votes
13
answers
385k
views
Flutter: how to make a TextField with HintText but no Underline?
This is what I'm trying to make:
In the Flutter docs for Text Fields (https://flutter.io/text-input/) it says you can remove the underline by passing null to the decoration. However, that also gets ...
288
votes
25
answers
285k
views
When the keyboard appears, the Flutter widgets resize. How to prevent this?
I have a Column of Expanded widgets like this:
return new Container(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
new ...
203
votes
17
answers
127k
views
How do I create a multiline TextField in SwiftUI?
I've been trying to create a multiline TextField in SwiftUI, but I can't figure out how.
This is the code I currently have:
struct EditorTextView : View {
@Binding var text: String
var ...
197
votes
24
answers
443k
views
How to change TextField's height and width?
How to customise TextField's width and height?
194
votes
36
answers
125k
views
How to hide keyboard when using SwiftUI?
How to hide keyboard using SwiftUI for below cases?
Case 1
I have TextField and I need to hide the keyboard when the user clicks the return button.
Case 2
I have TextField and I need to hide the ...
172
votes
22
answers
104k
views
SwiftUI: How to make TextField become first responder?
Here's my SwiftUI code:
struct ContentView : View {
@State var showingTextField = false
@State var text = ""
var body: some View {
return VStack {
if ...
165
votes
11
answers
127k
views
How to shift focus to the next TextField in Flutter?
I am new to Flutter.
I am building a form with multiple text inputs using following widgets: Form, TextFormField. The keyboard that appears doesn't show "next" (which should shift the focus to next ...
135
votes
18
answers
218k
views
Disable a text edit field in flutter
I need to disable TextFormField occasionally. I couldn't find a flag in the widget, or the controller to simply make it read-only or disable.
What is the best way to do it?
124
votes
14
answers
88k
views
How to debounce Textfield onChange in Dart?
I'm trying to develop a TextField that update the data on a Firestore database when they change. It seems to work but I need to prevent the onChange event to fire multiple times.
In JS I would use ...
108
votes
7
answers
115k
views
Flutter - How to change TextField hint color?
I'm a bit confused how to change the hint color of the textfield. Someone can guide me how to do it.Thanks
child: TextField(
style: TextStyle(fontSize: 20),
decoration: InputDecoration(
...
106
votes
24
answers
196k
views
What is the recommended way to make a numeric TextField in JavaFX?
I need to restrict input into a TextField to integers. Any advice?
104
votes
6
answers
83k
views
How to detect live changes on TextField in SwiftUI?
I have a simple TextField that binds to the state 'location' like this,
TextField("Search Location", text: $location)
I want to call a function each time this field changes, something like this:
...
103
votes
4
answers
218k
views
Flutter textfield background color on focus
I have a rounded textfield. It works well, but when the user taps on it, a grey color background appears. How can I disable that splash effect?
This is my code and result:
new Container(
...
100
votes
4
answers
106k
views
How to detect when a TextField is selected in Flutter?
I have a Flutter TextField which gets covered by the soft keyboard when the field is selected. I need to scroll the field up and out of the way when the keyboard is displayed. This is a pretty common ...
95
votes
5
answers
187k
views
Flutter: Outline input border
I was trying to build a border for my text field like:
return TextField(
...
border: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 5.0),
)
)
)
But it ...
88
votes
6
answers
223k
views
Customizing Increment Arrows on Input of Type Number Using CSS
I have an input of type number that is rendered using the following code:
<input class="quantity" id="id_form-0-quantity" min="0" name="form-0-quantity" value="1" type="number">
It looks like ...
87
votes
2
answers
62k
views
Rails not editable text field
I have a form_for written in the following manner:
<div class="field">
<%= location.label :city %>
<%= location.text_field :city, :disabled=>true%>
</div>
<div ...
83
votes
16
answers
126k
views
Flutter TextField value always uppercase & debounce
I am new in Flutter. I am looking for TextField value to always uppercase but I did not find any resource on that.
Another issue is the TextField onChanged event debounce implementation. When I type ...
82
votes
9
answers
149k
views
How can I limit the length of a text field input in flutter?
The TextField widget doesn't seem to have a "limit" attribute to limit the number of characters that can be typed. How I can enforce that only a certain number of characters can be provided as input ...
81
votes
15
answers
45k
views
How to add a TextField to Alert in SwiftUI?
Anyone an idea how to create an Alert in SwiftUI that contains a TextField?
78
votes
16
answers
83k
views
How do I remove content padding from TextField?
I am new to flutter and I am creating login form, for that I have used TextField and added prefix icon but I am getting some extra spaces in between textfields (user id and pin) and before the prefix ...
68
votes
9
answers
118k
views
How to expand a textField in flutter looks like a text Area
When i tap in textField in landScape mode i would like to expand in full screen likes whatsapp
TextFormField(
keyboardType: TextInputType.number,
decoration: ...
67
votes
2
answers
34k
views
In Material UI when do we use Input vs. TextField for building a form?
Maybe this is just a basic question, but so far have not found any reasonable explanation. I am a beginner in React and using Material UI very recently. I am not very clear on when to use an Input vs. ...
62
votes
11
answers
105k
views
Hide textfield blinking caret
I have a text input in my HTML. Is there a way to hide the blinking text caret when the input gets focus?
I am open to doing this with JavaScript or CSS.
58
votes
2
answers
97k
views
Change the default border color of TextFormField in FLUTTER
Unable to change the default border color when TextFormField is not active. When TextFormField is not active this shows DarkGrey-Border color. So, how to change that.
Theme(
data: new ...
56
votes
6
answers
220k
views
How to set the height of an input (text) field in CSS?
Sorry for this question but I can't seem to find an answer anywhere.
I have CSS code that should set the height of my text box. I am using VS2010 Express for Windows phone, coding in HTML/CSS/...
55
votes
2
answers
99k
views
focusing a text field in swift
I have 4 textfields on a register screen and i have it set up so that when the user presses next on each text field, the next text field is focused. Code below:
func textFieldShouldReturn(textField: ...
55
votes
2
answers
82k
views
How can I use ref in TextField
my original code was like this:
handleClick() {
var name = this.refs.name.value;
var description = this.refs.description.value
}
render () {
return (
<React.Fragment>
<input ref='...
48
votes
3
answers
75k
views
How to set focus to an iOS text field?
How do you programmatically set focus to some UITextField in iOS?
When you tap on a textfield, the keyboard pops up to begin editing the textfield.
How can you give focus to a textfield and bring up ...
47
votes
5
answers
80k
views
How to get rid of blue outer border when clicking on a form input field?
Hi I want to get rid of the blue "shine" that appears when you click on a text field and begin to input data. How is this done?
I am a beginner so I am not that experienced.
My code is:
<input ...
46
votes
11
answers
90k
views
Vertically Centre Align Text in TextField Flutter
I tried finding in a lot of resources but unfortunately i could not find a way to align the text vertically centre in a textfield. I also tried using suffixIcon instead of suffix but still not luck. ...
45
votes
7
answers
33k
views
Autofocus TextField programmatically in SwiftUI
I'm using a modal to add names to a list. When the modal is shown, I want to focus the TextField automatically, like this:
I've not found any suitable solutions yet.
Is there anything implemented ...
44
votes
3
answers
33k
views
How can I configure auto-capitalization behavior in Flutter's text entry fields?
I'm experimenting with Flutter development on Windows. I have a simple test app with an InputField. I would like the first keyboard entry to be a capital letter but can't see a way of achieving that ...
43
votes
30
answers
172k
views
Best way to restrict a text field to numbers only?
I'm using the following Javascript to restrict a text field on my website to only accept numerical input, and no other letters or characters. The problem is, it REALLY rejects all other key inputs, ...
41
votes
10
answers
49k
views
How to remove underline below TextField?
Here is the code. I want to remove the black underline just below text, and currently the TextField is in edit mode:
TextField(
autofocus: true,
decoration: InputDecoration.collapsed(
...
40
votes
10
answers
145k
views
HTML input field hint
I want to provide the user with a hint on what he needs to enter into my text field. However, when I set the value, it does not disappear once a user clicks on the text field. How can you make it ...
40
votes
4
answers
21k
views
I have trouble using cornerradius and borders on a textfield in SwiftUI
I have a text field in swiftUI, and in order to make it more appealing I'd like to add a border and have rounded corners. But it doesn't seem to work like it's supposed to (see image). What did I miss?...
37
votes
4
answers
26k
views
How to disable predictive text in TextField of Flutter?
I want to disable predictive text which comes in the keyboard of a textfield. It is not so difficult in native android and IOS but I have not found a solution in a Flutter.
I have tried using ...
35
votes
4
answers
46k
views
How to show the Keyboard automatically for a Textfield in Flutter
I have a TextField in Flutter of which I want to automatically select the text and show the keyboard.
I can select the text through a TextEditingController, but even with a FocusNodes requestFocus ...
34
votes
3
answers
21k
views
Disable HTML escaping in Django's TextField
How can I turn off Django's automatic HTML escaping, when I write into model's TextField?
34
votes
7
answers
44k
views
Flutter TextField input only decimal numbers
I want to input only decimal number in TextField in Flutter. I tried below code but that's not working. It allows alpha (a-z) and special characters.
TextField(
controller:
new ...
34
votes
4
answers
13k
views
SwiftUI TextField cursor colour
Currently the cursor/caret for my SwiftUI TextField is blue. Is there an API for cursor colour or a workaround?
34
votes
3
answers
33k
views
Flutter: Bottom sheet with TextField/TextFormField
In part of our application, I would like to have a simple form in BottomSheet like with the below code. unfortunately when i put into that, I get an error
The following assertion was thrown during ...
33
votes
7
answers
34k
views
How can I add a bottom line on TextField (SwiftUI)
I use Rectangle() to adding a bottom border on TextField (SwiftUI)
But I want to use protocol TextFieldStyle for a bottom line on TextField Style like an RoundedBorderTextFieldStyle
How can I make a ...
32
votes
4
answers
40k
views
Change TextField's Underline in Flutter
I'm working on an application using Flutter SDK. When I use a TextField widget, and I focus it, the underline becomes blue. I need to change this color to red, how can I do it?
Screenshot of what I ...
31
votes
16
answers
33k
views
javascript to find leap year
How can I get the code below to work when I have a month of february? Currently it is getting to the day and then stopping before getting to the if to determine whether it is a leap year.
if (month ...
30
votes
4
answers
127k
views
How to invalidate a TextField in Material UI
I am using TextField component to capture phone number. As the user is typing, I want to invalidate the entry if it is not a number or if it does not follow a format and display the errorText. ...