Python Forum
form select option tags, add "selected" on <option> in python at a condition
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
form select option tags, add "selected" on <option> in python at a condition
#3
<option value="meatfish" {{ 'selected' if recipe.category_name == 'meatfish' else '' }} >Meat&Fish</option>
You could use the expression syntax to print "selected" or "".
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
RE: form select option tags, add "selected" on <option> in python at a condition - by DeaD_EyE - Jul-12-2020, 05:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  a Python class for Option deberi 5 2,912 Apr-28-2020, 08:05 AM
Last Post: buran
  #python .... Need to develop a if condition from two lists ginu 2 2,905 Oct-05-2018, 12:45 PM
Last Post: gruntfutuk
  click menu option 6 it does not print out what I need it to AMRiley23 4 3,994 Nov-27-2017, 09:03 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020