0

I changed my mind about using flask-bootstrap and uploaded my CSS. But after that, all labels disappeared in my form. Only the fields themselves remained. What am I doing wrong?

These are HTML:

{% block content %} {% block prepare %}

<form action="" , method="post" , novalidate, class="Preparation_area">
  <h3>Prepare Data</h3>
  {{ prepare_form.hidden_tag() }}
  <p>
    {{ prepare_form.archive.label }} {{ prepare_form.archive }} {{ prepare_form.select_order.labe }} {{ prepare_form.select_order }} {{ prepare_form.h_back.labe }} {{ prepare_form.h_back(size=3) }} {{ prepare_form.min_deep.labe }} {{ prepare_form.min_deep
    }} {{ prepare_form.max_deep.labe }} {{ prepare_form.max_deep(size=4) }} {{ prepare_form.groupping.labe }} {{ prepare_form.groupping(size=3) }} {{ prepare_form.sort_levels.labe }} {{ prepare_form.sort_levels }} {{ prepare_form.submit_prepare() }}
  </p>
</form>
{% endblock %} {% block content %}

These are FORMS:

class Prepare(FlaskForm):
    archive = FileField(label='Upload archive', validators=[FileRequired(), regexp('[\w-].xlsx$')])
    select_order = SelectField(label='Select order', choices=['5-1','5-2','5-3','5-4','5-5','2-1','2-2'], validate_choice=True)
    h_back = StringField(label='h-back', validators=[DataRequired()], render_kw={"placeholder": "10"})
    min_deep = StringField(label='minDeep', validators=[DataRequired()], render_kw={"placeholder": "1"})
    max_deep = StringField(label='maxDeep', validators=[DataRequired()], render_kw={"placeholder": "20"})
    groupping  = StringField(label='Groupping', validators=[DataRequired()], render_kw={"placeholder": "0"})
    sort_levels = SelectField(label='Sort.Lev.', choices=['No','sort_1','sort_2','sort_3'], validate_choice=True)
    submit_prepare = SubmitField(label='Preparate Data')

These are ROUTES:

@app.route('/', methods=['GET', 'POST'])
@app.route('/index', methods=['GET', 'POST'])
@login_required
def index():
    prepare_form = Prepare()
  
    if prepare_form.validate_on_submit():
        if prepare_form.validate_on_submit():
            archive = prepare_form.archive.data#request.FILES[prepare_form.archive.name].read()
            select_order = prepare_form.select_order.data
            h_back = prepare_form.h_back.data
            min_deep = prepare_form.min_deep.data
            max_deep = prepare_form.max_deep.data
            groupping = prepare_form.groupping.data
            sort_levels = prepare_form.sort_levels.data
            flash(h_back, min_deep, max_deep)
        
        
    predict_form = Predict()


    return render_template('index.html', prepare_form=prepare_form, predict_form=predict_form)

And these ar CSS

html {
    background-color: #1f1e1e;
    font-size: 12px;
    font-family: 'Open Sans', sans-serif;
    color:aliceblue
  }

body {
  padding: 10px 0px 0px 0px;
  }

.Preparation_area {
  padding-left: 20px;
  margin: 10px 0px 10px 0px;
  border-radius: 10px;
  border: 1px solid black;
  background-color:#333232;
  display: flex;
  }



h3 {
  margin-top: -10px;
  width:fit-content;
  padding: 0px 2px 0px 2px;
  font-size: 14px;
  color: aliceblue;
  }

Thank you for your help!

kannt_im
  • 9
  • 3
  • first you could use `DevTools` in Chrome/Firefox to see if you load CSS and if they are correct - maybe you forgot to add links in HTML to load CSS, or you have wrong values in CSS and items are not visible. – furas Sep 27 '22 at 07:13
  • CSS loading fine... But when I look at the HTML output, labels are missing. I can see only first element's label - its a FileField. The other field labels are not passed to HTML – kannt_im Sep 27 '22 at 10:51
  • in template you have `.labe` but it should be `.label` – furas Sep 27 '22 at 12:10
  • Thank you very much! I am very sorry that I took up your time with such stupidity. I am just learning and have been trying to solve this issue for two days. Thanks again! – kannt_im Sep 27 '22 at 14:50
  • below is place for solution/answer - so you should rather describe what you do to resolve problem. And later you can mark this answer as accepted, and this will inform other people that problem was resolved. But for typo usually we simply close question without answers. – furas Sep 27 '22 at 15:01

1 Answers1

0

Thanks to furas. He found my stupid mistake

kannt_im
  • 9
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 30 '22 at 15:45