You could do something along these lines:

{% for field in form %}
...
<!-- The Radio Field -->
{% ifequal field form.someSpecificField %}
<input type="radio"  onClick="..." name="{{ field.name }}" value="{{
field.value }} />
{%endif %}
...
{% endfor %}

(That syntax may not be perfect, I just typed it in real quick). Hopefully
that helps a bit.

On Tue, May 1, 2012 at 11:27 PM, jondykeman <jondyke...@gmail.com> wrote:

> Hello,
>
> I have the following situation:
>
> I am rendering an array of ModelForms to my template. ie. formArray =
> [<ModelForm1>, <ModelForm2>, <ModelForm3>]
>
> In the template I display the forms with the following:
>
> {% for form in formArray %}
> <div class="clearfix">
> {{ form }}
> </div>
> {% endfor %}
>
> Previously I have accessed certain ModelForms using {% if forloop.counter
> == # %} to add some customization.
>
> However, now I would like more detailed control of certain field tags
> within a given ModelForm. ie. ModelForm2 is a RadioSelect, and I would like
> to add an onChange="some function" to one of the Radio Buttons within this
> ModelForm.
>
> Is there a way to access this specific field in my implementation
> directly? Or, through the use of a custom template filter?
>
> To give the larger picture my goal is to have an "Other" RadioButton that
> when selected shows a Other text input using javascript, but while using
> ModelForms.
>
> As such, if there is an entirely different way to going about this I would
> love to hear it.
>
> Any help would be greatly appreciated!
>
>
> JD
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/OVPO5oqiXc4J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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

Reply via email to