I simply want to populate a drop select based on what was selected in a
previous drop select box I found a dajax/dajaxice method but it does not
seem to trigger any clues please?
views.py
from dajax.core import Dajax
from dajaxice.decorators import dajaxice_register
@dajaxice_register
def updatecombo(request, option):
dajax = Dajax()
options = TopicChoices.objects.all().filter(theme=option)
out = []
# for option in options[int(option)]:
for opt in options:
out.append("<option value='#'>%s</option>" % opt)
dajax.assign('#combo2', 'innerHTML', ''.join(out))
return dajax.json()
search.html
<select onchange="Dajaxice.updatecombo(Dajax.process,
{'option':this.value})" size="1"><option value="">Please select</option>
{% for x in form.adv_choices %}
<option value="{{ x.id }}"{% ifequal x.id
selected_adv %} selected="selected"{% endifequal %}>{{ x.title }}</option>
{% endfor %}
</select>
<select id="combo2" onchange="" size="1"></select>
<div style="background-color:#50593B; margin-top: 0px;
padding:20px 0px; ">
I don't get any errors just no population of "combo2"
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.