Questions tagged [textfield]

A text field (or text box) is a user-interface control allowing the user to input text into a program.

A typical text field is a rectangle, often with a border. It can be either single-line or multi-line. In addition to typing, text fields allow for a variety of other activities, such as text selection (cut, copy, paste).

This GIF ("File:Textbox2.gif" on Wikimedia Commons) depicts a text field with text being entered:

A text field with the word 'Wikipedia' being typed in

4965 questions
48
votes
3 answers

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 the keyboard without requiring the user to tap on…
Ravi kumar
  • 601
  • 1
  • 6
  • 7
47
votes
5 answers

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:
James
  • 1,895
  • 6
  • 27
  • 34
45
votes
2 answers

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 (
GG-sof
  • 441
  • 1
  • 4
  • 4
43
votes
30 answers

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, like ctrl-A to select the text, or even any other…
RobHardgood
  • 550
  • 1
  • 8
  • 17
42
votes
2 answers

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 (e.g. launching the keyboard with shift pressed)…
iBob101
  • 1,460
  • 3
  • 14
  • 20
41
votes
10 answers

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( hintText: "Search", border:…
Rahul Lohra
  • 824
  • 1
  • 10
  • 21
40
votes
10 answers

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 disappear?
Frank Vilea
  • 8,323
  • 20
  • 65
  • 86
40
votes
6 answers

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 into SwiftUI already in order to do this? Thanks for…
Nils
  • 1,755
  • 3
  • 13
  • 25
40
votes
10 answers

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. Here is my code : import…
35
votes
4 answers

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? I've tried putting .cornerradius() before…
Sydney
  • 383
  • 1
  • 5
  • 9
33
votes
3 answers

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 performLayout(): An InputDecorator, which is…
DolDurma
  • 15,753
  • 51
  • 198
  • 377
33
votes
7 answers

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 TextEditingController(text:…
Sagar Zala
  • 4,854
  • 9
  • 34
  • 62
32
votes
7 answers

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 custom style for TextField without using…
Shawn Baek
  • 1,928
  • 3
  • 20
  • 34
32
votes
4 answers

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 need to change. I want just the underline to…
Tiziano Gioè
  • 683
  • 2
  • 7
  • 8
32
votes
3 answers

Disable HTML escaping in Django's TextField

How can I turn off Django's automatic HTML escaping, when I write into model's TextField?
evgeniuz
  • 2,599
  • 5
  • 30
  • 36