Hi, I'm with a basic doubt.
I want to make a Select Form using ModelChoiceField in a webpage. The
data is being filled OK, but I don't know how to use the selected
item.
For instance, I want to call a page "/dashboard/{{ projetoURL }}/
{{ selectedItem }}/" where the 'selectedItem' is an option chosen with
the Select form.

I have this class in views.py:
--
class clSelectCiclo(forms.Form):
    selectCiclo = forms.ModelChoiceField(label='Ciclo:', queryset =
Ciclo.objects.all().order_by('-datinicio'))
--

and I'm passing this variable to the template:
--
comboCiclo = clSelectCiclo(initial={'selectCiclo': cicloAtual})
--

and this is the code put into my index.html
--
<div>
        <form onchange="/dashboard/{{ projetoURL }}/{{ selectedItem }}"
method="post">
        {% csrf_token %}
                {{ comboCiclo }}
        </form>
</div>
--

The Select form is being displayed OK, and the {{ projetoURL }}
variable is not the problem. I want to know how to use correctly the
variable {{ selectedItem }}, and what do I have to do to make that the
changing on the Select Form call the URL that I put at the "onchange"

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to