Changeset 6803
- Timestamp:
- 12/01/07 13:31:53 (1 year ago)
- Files:
-
- django/trunk/docs/newforms.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/newforms.txt
r6802 r6803 757 757 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 758 758 759 You may wish to show a visitor which fields are required. Here is the above 760 example modified to insert an asterix after the label of each required field:: 759 It's common to show a user which fields are required. Here's an example of how 760 to do that, using the above example modified to insert an asterisk after the 761 label of each required field:: 761 762 762 763 <form method="post" action=""> … … 773 774 774 775 The ``{% if field.field.required %}*{% endif %}`` fragment is the relevant 775 addition here. It adds the asterix only if the field is required. Note that we 776 check ``field.field.required`` and not ``field.required``. In the template, 777 ``field`` is a ``newforms.forms.BoundField`` instance, which holds the actual 778 ``Field`` instance in its ``field`` attribute. 776 addition here. It adds the asterisk only if the field is required. 777 778 Note that we check ``field.field.required`` and not ``field.required``. In the 779 template, ``field`` is a ``newforms.forms.BoundField`` instance, which holds 780 the actual ``Field`` instance in its ``field`` attribute. 779 781 780 782 Binding uploaded files to a form
