Python Flask WT-Form MultiCheckboxField Demo: Five Guys use checkboxes to choose toppings

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 6

  • @BonaFideBOSS
    @BonaFideBOSS 10 месяцев назад

    How to set html attriutes to each of the checkbox choices (key and value) (different for each choice)?

    • @thomasblum9803
      @thomasblum9803  9 месяцев назад +1

      At about the five-minute mark, the MultiCheckboxField code is discussed. The choices are a list of tuples. Each tuple has two component. You mention key and value; I usually talk about value (what is passed behind scenes) and text (what is seen by the user). In this example the two components are the same, but they could be different. (Maybe I am misunderstanding the question.)

    • @BonaFideBOSS
      @BonaFideBOSS 9 месяцев назад

      ​@@thomasblum9803 No. I do know about the main input name and value. I was asking how to set additional custom html attributes like data attribute with different values for each checkbox dynamically.

    • @thomasblum9803
      @thomasblum9803  9 месяцев назад

      Maybe try render_kw: I have used it to add a class attribute: render_kw={'class':'no_bullets'} I assume it can be use for other attributes.

    • @thomasblum9803
      @thomasblum9803  9 месяцев назад

      I think I am beginning to understand the question, but I don't have an answer at this point. Sorry.

  • @thomasblum9803
    @thomasblum9803  Год назад

    www1.lasalle.edu/~blum/c341wks/Flask_WTF_MultiCheckboxField_FiveGuys.zip