On 3/2/07, Michael Lake <[EMAIL PROTECTED]> wrote: > > Malcolm Tredinnick wrote: > > On Fri, 2007-03-02 at 15:27 +1100, Michael Lake wrote: > > > >>Hi all > >> > >>I see in the documentation for forms that the HTML output will include the > >>validation > >>errors as a <ul> near the field. How does one change that? I would like the > >>errors to > >>be after the form field similar to this below irrespective of whether im > >>rendering it > >>as_p or asdefault table layout. > >> > >>Name: [ ] < This field is required > >> > >>rather than > >> > >> * This field is required > >>Name: [ ] > > > > > > Have a look at the errors_on_separate_row parameter in the html_output() > > method of the newsforms.form.Form class. Passing that in as True should > > do what you want. It means you will need to write your own version of > > as_ul() or as_table() if you want to use those methods, but they're only > > convenience methods in any case -- overriding or using your own wrapper > > is encouraged for anything funky. > > > > So either call html_output() and pass in your format strings manually, > > with a trailing True parameter, or write your own wrapper for this in > > your Form subclass. > > Thanks, that gives me a starting point for lots more investigation. I can see > in > forms.py on the Django site where as_table() and _html_output() are defined. > It will take me a day to digest it. Searching for 'errors_on_separate_row' > also gives > me a few links to follow.
if everything fails, you can still return to the hard way and use: {{ form.field1 }} {% if form.field1.errors %} <ul><li>{{ form.field1.errors|join:"</li><li>" }}</li></ul>{% endif %} > > Thanks > -- > Michael Lake > > > > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---