On Fri, 2007-03-23 at 16:31 -0400, Todd O'Bryan wrote:
> I'm trying to create the following workflow for a website where teachers
> can create questions for their students:
> 
> 1. The teacher click a link to create a new question.
> 2. A form appears where the teacher can enter information, including
> formatting information in some kind of wiki-like language. At the bottom
> of the form, the teacher clicks Cancel (to discard what they were
> working on) or Preview (to see the question formatted).
> 3. After clicking Preview, the question is shown in HTML glory, with
> three buttons at the bottom: Save, Edit, or Cancel.
> 
> Here's my question: how do I keep track of the information while the
> teacher is previewing it so that I can have access to it when I want to
> edit or save it? The obvious answer is to stick in a form filled with
> hidden fields, but I can't figure out any way to do that without
> defining a completely new form that's exactly the same as the original
> except that all the fields are hidden, and that just seems silly.
> 
> Any brilliant ideas that avoid violation of DRY?

Quite often, preview and edit are combined on the same form, so you see
the preview version at the top and the editable fields lower down. If
you do this, your single form (for edit/create) just needs a block at
the top that contains the optional "static preview" version.

Another way is to layout the form fields as you normally would and then
use CSS to hide them (feels ugly to me, but technically possible).

If you don't want to do either of these and truly want to store the
information in hidden fields the second time around, then, yes, you are
going to have to specify all the hidden fields, or provide a way to
alter the "type" of your original fields between their editable type and
"hidden". So there will be some repetition, whether you generate them
programmatically or by hand. That really can't be avoided because you
*are* repeating the information.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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