Monday, July 23, 2012

Checking if a dynamicallygenerated dropdown has a selected item

Hi all,

I have a dynamically generated dropdown in this fashion (when viewing source):

<select name="question_3_answers">
               <option name="question_3_answer0" selected="selected"></option>
               <option name="question_3_answer_7}" value="question_3_answer_7">a) Spend the majority of time indoors</option>
               <option name="question_3_answer_8}" value="question_3_answer_8">b) Value superior darkness and consider in-car activation</option>
               <option name="question_3_answer_9}" value="question_3_answer_9">c) Value indoor clarity over outdoor darkness</option>   
</select>

<select name="question_4_answers">
               <option name="question_4_answer0" selected="selected"></option>
               <option name="question_4_answer_7}" value="question_3_answer_7">a) Spend the majority of time indoors</option>
               <option name="question_4_answer_8}" value="question_3_answer_8">b) Value superior darkness and consider in-car activation</option>
               <option name="question_4_answer_9}" value="question_3_answer_9">c) Value indoor clarity over outdoor darkness</option>   
</select>

How would one check, in a view, whether or not any of the dropdowns have a selected item? I basically need to ensure that users answer at least 3 out of 5 questions?

Thanks ...
--
Regards,
Sithembewena Lloyd Dube

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment