Hi,
Coming from PHP world, I used to create select box like this:
<select>
<?php foreach($arrField as $idx=>$val){?>
<option <?php echo ($fieldVal == $idx ? "selected='selected'" : ''); ?>><?php echo $val; ?></option>
<?php } ?>
</select>
However, I can't do that in python. Here's my snippet:
<select name='type'>
<option value='normal' {% if id = 'normal' %} selected="selected"{% endif %}>1-Normal</option>
<option value='image' {% if id = 'image' %} selected="selected"{% endif %}>2-Image</option>
</select>
I got this error:
TemplateSyntaxError: 'if' statement improperly formatted
Is there a way to do this?