All of the examples in the Django documentation seem to deal only with
hardcoded forms, in other words the programmer/designer knows how many
field the form will/should have. I am creating a survey system. A
survey will have X number of questions, so my template is generic
enough to handle X number of questions per survey, but I am facing the
following problems:

1. Is there anyway I can use manipulators to validate the survey? My
guess is that you can't, but I am hoping I am wrong.
2. Whether I can or can't use manipulators, I will still have the
problem of how to display the correct error message above the field
that caused the error message.

For example, let say the following is the code of the template that
displays the survey:
{% for question in survey.question.all %}
                              <li>
                                      <div>
                                              <h3>{{ question.text
}}</h3>
                                              {% if
question.description %}
                                              <p>{{
question.description }} </p>
                                              {% endif %}
                                              <table border=1>
                                                      <tr>
                                                              {% for
answer in question.answer.all %}

<td><input type="radio" name="question{{ question.id }}"
value="{{ answer.id }}" id="question{{ forloop.parentloop.counter }}{{
forloop.counter }}" />{{ answer.text }}</td>
                                                              {%
endfor %}
                                                      </tr>
                                              </table>
                                              {% if
question.needsComment %}
                                              <div>
                                                      <p>Comment:</p>
                                                      <p>

<textarea name="question{{ question.id }}Comment"></textarea>
                                                      </p>
                                              </div>
                                              {% endif %}
                                      </div>
                              </li>
                      {% endfor %}
I am validating the form and adding a dictionary which contains the
error messages to the context of the template. The dictionary structure
is something like:
{'questionX':'ErrorMessage','questionX:'Error Message'} where X is the
question ID

how do I access the correct error message on the template if the key
for the dictionary is a combination of hardcoded text and variables?


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to