Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is posible to render wtf.form_field with out label?

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.

like image 600
pelos Avatar asked Feb 28 '18 19:02

pelos


People also ask

Why use WTF forms?

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.

What is WTF in Flask?

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.

What is Stringfield?

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.


1 Answers

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;

}

like image 73
nakb Avatar answered Sep 28 '22 07:09

nakb