I am using flask with bootstrap, and I need to create a field without the label, since I will be putting it as a placeholder, that way save space in the UI, since this field appears several times.
{{ wtf.form_field(field) }}
I don't want Label Field, just the actual field that the user will type his information.
WTForms is a Python library that provides flexible web form rendering. You can use it to render text fields, text areas, password fields, radio buttons, and others. WTForms also provides powerful data validation using different validators, which validate that the data the user submits meets certain criteria you define.
WTF stands for WT Forms which is intended to provide the interactive user interface for the user. The WTF is a built-in module of the flask which provides an alternative way of designing forms in the flask web applications.
The string field is used for allowing users to enter unformatted text information into your form in a limited fashion. Creating multiple strings is useful for collecting directed information, such as answers from your user requiring single words or brief sentences.
Coming to this a bit late but I find the easiest way is to use CSS to set the visibility of the label to None.
.control-label {
display: none;
}
The above CSS will make all labels invisible. This may not be desirable for every label but if add a "no-label" class to specific WTF form fields (or indeed a higher element that groups the fields) the following CSS will not display the labels for those fields:
.no-label .control-label {
display: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With