So I have a Jquery UI Autocomplete widget in my Jinja2 template which works great. However, I want the value of each program to be the program ID, not the name. IE: {{ p.id }} How do I set the name as the label and the id as the value?
<script>
$(function() {
var programs = [
{% for p in programs %}
'{{ p.Name }}',
{% endfor %}
];
$( "#programs" ).autocomplete({
source: programs
});
});
</script>
<input type="text" name="program" id="programs" />