I've once tried something like this, but was (partially) unsuccessful. The thing is that you build your form with some data, and later when the data comes back, you will want to process and validate the received data, right? But how can you do that if you only received partial data -- because as some fields are readonly, their data will not be in the received dataset?
Imagine you have a required-and-readonly field. You draw the form, but when the user submits the form, that field's data will not come back (as its a readonly field) and you'll get a "required" error. I've hacked around this limitation by monkeypatching some methods and defining "missing" together with "readonly". But I think that it can be hard to put it all together in colander and deform. If you guys have any idea, I would like to know too. :) 2011/7/30 keesjan <[email protected]> > As far as I understand, deform now has an all-or-nothing approach for > readonly fields at the form level. > > There're occasions, though, when you want a form where only some > fields are editable, but others should remain readonly. The most > obvious example is a persisted ID field. > > Ideally, I like to have the option to pass a readonly flag to the > widget, like so: > > form['id'].widget = TextInputWidget(readonly=True) > > Unfortunately, this is currently not supported. > > Is this a sensible feature request or are there other ways to achieve > the same result?! > > (A TextDisplayWidget is an obvious alternative, but this is very crude > and doesn't fit in nicely with the readonly support already given.) > > > Kind regards, > > Keesjan > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
