Hello all,

I posted this to stackoverflow a couple weeks ago, but I have yet to get any
takers.  I was able to backburner this for a little bit, but I'd like to see
it wrapped up.

In my form class, I have a forms.ChoiceField whose widget is a
forms.RadioSelect widget, one of whose choices needs to be presented with an
inline text input (which is also a field in the form). I'm using custom
validation to ignore the text field when its radio choice is not selected.
When rendered, I want it to appear like below:

<ul>
<li><label for="id_rad_0"><input type="radio" id="id_rad_0" value="none"
name="rad" /> No Textbox</label></li>
<li><label for="id_rad_1"><input type="radio" id="id_rad_1" value="one"
name="rad" /> One Textbox: <input type="text" name="bar" id="id_bar"
/></label></li>
</ul>

However, I can't simply produce this in my template, because the radio
choices are not exposed. I can't see a way to do this without tightly
coupling my form to my template, or alternately, putting all of the
presentation logic in the form class. What is the right way to solve this
problem?

I'm a much better backend programmer than web designer, and I'm on this
project alone, so maybe it's a lack of education - is what I described
simply poor design? Should I just be designing this a different way? I'm
really open to any suggestion here that will help me move past this.

If you're a stackoverflow user, and you'd like 15 rep for answering, 
http://stackoverflow.com/questions/6218299/django-form-radio-input-layout
the question is here 
-- 
View this message in context: 
http://old.nabble.com/django-form-radio-input-layout-tp31862033p31862033.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
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