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
31
votes
4 answers

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 the keyboard isn't shown, when the Widget opens.…
relascope
  • 4,399
  • 4
  • 22
  • 27
31
votes
4 answers

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 autocorrect: false and changing keyboardtypes but it is…
sk_462
  • 587
  • 1
  • 7
  • 16
30
votes
3 answers

OnAppear calls unexpectedly when Keyboard Appears in SwiftUI

I am experiencing very odd behavior in SwiftUI 2.0 and iOS14. When the keyboard appears on the screen, the OnAppear method of other tab's view called automatically. However, this works fine Xcode 11.7 Here is the issue in action. Here is the code…
Malav Soni
  • 2,739
  • 1
  • 23
  • 52
30
votes
4 answers

SwiftUI TextField cursor colour

Currently the cursor/caret for my SwiftUI TextField is blue. Is there an API for cursor colour or a workaround?
SnoopDogg
  • 441
  • 1
  • 5
  • 8
30
votes
4 answers

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. Currently errorText is displayed even without touching…
Mo3z
  • 2,138
  • 7
  • 21
  • 29
29
votes
16 answers

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 == 2) { if (day == 29) { if (year % 4…
Juan Almonte
  • 375
  • 2
  • 8
  • 14
27
votes
5 answers

Programmatically set value in material-ui Autocomplete TextField

In my React app I have an input which could take value from the dropdown list. For that putpose I use material-ui Autocomplete and TextField components. Question: how can I programmaticaly set an input value by clicking on the button without…
Sergey
  • 995
  • 4
  • 14
  • 33
26
votes
4 answers

TextFormField validator not working - The method 'validate' was called on null

I am trying to build a simple login page for a new flutter app. The widget tree is very basic. It consists of a MaterialApp that contains a Scaffold. The 'home' of the Scaffold is a StatefulWidget which contains the Form with two TextFormFields…
Santhosh Jose
  • 517
  • 1
  • 6
  • 18
26
votes
4 answers

Flutter textfield that auto expands when text is entered and then starts scrolling the text when a certain height is reached

I've tried many configurations of the Flutter TextField but can't figure out how to build this one. I'm looking for a textfield that is a single line initially and it auto expands as the text is entered into it and then at some point begins…
sujay_br
  • 565
  • 2
  • 7
  • 16
26
votes
9 answers

How can I declare that a text field can only contain an integer?

In swift, I am trying to make a text field that will allow a button to be enabled, but only when the text field contains an integer. How can I do this?
user4241521
26
votes
6 answers

Only allow certain characters to be entered in html textinput

I just need to allow a user to enter the following characters in the textinput: a-zA-Z0-9!@#$%^*_|
User Name:
baburao113
  • 785
  • 2
  • 8
  • 12
24
votes
6 answers

iOS 14 SwiftUI Keyboard lifts view automatically

I am using TextField in my view and when it becomes the first responder, it lefts the view as shown in the below GIF. Is there any way I can get rid of this behavior? Here is my code NavigationView(content: { ZStack{ …
Malav Soni
  • 2,739
  • 1
  • 23
  • 52
23
votes
3 answers

Why does the Software Keyboard cause Widget Rebuilds on Open/Close?

I have a screen, which contains a Form with a StreamBuilder. when I load initial data from StreamBuilder, TextFormField show data as expected. When I tap inside the TextFormField, the software keyboard shows up, which causes the widgets to rebuild.…
Roshan
  • 3,236
  • 10
  • 41
  • 63
23
votes
4 answers

TextField Loses Focus with setState

I have a custom StatefulWidget that when typing into an empty field, it will automatically add a new empty field below so the user can keep adding data. However, as I use setState in onChanged to add the new field, the keyboard is dismissed and…
Josh Kahane
  • 16,765
  • 45
  • 140
  • 253
23
votes
3 answers

How to type some text in hidden field in Selenium WebDriver using Java

I am using WebDriver with Java for test automation. I have the following HTML code for input field which is hidden: How to type something in hidden field in Selenium2 (WebDriver)? I have written…
user1554024