1

I would like to show a completed form using a model instance and the form class that was used to render the form. Basically, I want to show the 'completed' form, read-only. Is there an easy way to do this?

user1487178
  • 83
  • 1
  • 1
  • 10
  • Have you seen this http://stackoverflow.com/questions/324477/in-a-django-form-how-to-make-a-field-readonly-or-disabled-so-that-it-cannot-b/331550#331550 – super9 Feb 22 '13 at 02:18

1 Answers1

1

Sure. Just set the readonly property on your inputs for the "completed" form: http://www.w3schools.com/tags/att_input_readonly.asp

Brandon Taylor
  • 33,823
  • 15
  • 104
  • 144
  • Note that as this feature is strictly client-only funny things may happen if the user removes the attribute and posts the form. – wRAR Feb 22 '13 at 01:30
  • True. There are a couple of ways to do this. If it's client-side only, with readonly, there's really no reason to present the fields within a form tag to begin with, or allow the form to be posted anywhere. I'm not sure why the OP would want to present the form again, in readonly fashion. I would just present the values previously entered. – Brandon Taylor Feb 22 '13 at 01:33
  • Thanks for the replies. The thing is I am dealing with a huge form. It looks like having to write html just to display the values is a waste. The other thing is that some forms are familiar to everyone in a particular format. Think of paper-based forms. I thought it would make sense to use the same format. – user1487178 Feb 22 '13 at 05:07
  • Sure, I understand. In this case, I would make all of the fieldsets an include. This way you can render the fields in a form tag for the editable form, and without a form tag for read-only. That way you don't have a way to post the form for read-only, even if someone uses Firebug, etc, to manipulate the form. – Brandon Taylor Feb 22 '13 at 14:26