Python Flask WTForms Demo: Splitting Drop-Down Select Values on a Delimiter (in Python or in Jinja)

Поделиться
HTML-код
  • Опубликовано: 17 июл 2023
  • This video takes our ongoing example of a WT-Form one step further by having a more complicated value passed by a drop-down select. While previously the drop-down select had options with values like value="#FF0000" (just a color hexcode), this time we are electing to pass two pieces of information concatenated together with a separator/delimiter, that is the options have values like value="red|#FF0000" (color name and hexcode). The splitting can be handled in two places. It can be handled in the Python/Flask file that handles the routes -- as the information is passed from HTML form to HTML form handler, we can use the intermediary Python to split the color value and pass on the individual pieces. Alternatively, the unsplit data can be sent to the handler which can effect the splitting using Jinja.

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

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

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