can you post an example? I am sure there is a better way. Massimo
On Jun 13, 3:28 pm, Hans Donner <hans.don...@pobox.com> wrote: > the model has some more fields, entered by the user. This filed is > prepopulated by the server. > On submitting the prepopluated value may be not valid any more, but > may not be updated by the server > (is considered part of the user submitted fileds). > > Currently worked around it by adding a hidden field with the data and > supplying an onvalidation. > > On Sat, Jun 13, 2009 at 6:31 PM, mdipierro<mdipie...@cs.depaul.edu> wrote: > > > I do not understand. If the fields are marked readonly (as in > > db.table.field.readonly=True) the field is not submitted from the > > client to the server with the form. The form is populated serverside. > > > Massimo > > > On Jun 13, 10:38 am, Hans Donner <hans.don...@pobox.com> wrote: > >> Well, depends what you call 'inserted by the visitor'. In this case > >> I'm prepopulating the form, some fields are not editable, but the user > >> should submit these values as well. > >> Guess I have to use onvalidate then to make sure all is ok. > > >> The second remark in my original posting: the 'unique' should somehow > >> be supported by DAL, or warnings should be submitted that it is > >> unsupported. > > >> On Sat, Jun 13, 2009 at 4:39 PM, mdipierro<mdipie...@cs.depaul.edu> wrote: > > >> > back to the original question. Should they validate? If they are > >> > readonly it means they are not inserted by the visitor. We only > >> > validate visitor provided input. > > >> > Massimo > > >> > On Jun 13, 9:02 am, Hans Donner <hans.don...@pobox.com> wrote: > >> >> sorry, should be db.table.field.default = '' > > >> >> On Sat, Jun 13, 2009 at 3:54 PM, mdipierro<mdipie...@cs.depaul.edu> > >> >> wrote: > > >> >> > I am not what you mean by: > > >> >> > db.table.field = 'some invalid value for the requires[]' > > >> >> > It seems to be redefining the field. It should give an error. > > >> >> > On Jun 13, 8:28 am, Hans Donner <hans.don...@pobox.com> wrote: > >> >> >> db.define_table( > >> >> >> 'test', > >> >> >> SQLField('unique', 'string', unique = True, > >> >> >> requires = IS_NOT_IN_DB(db, 'test.unique')), > >> >> >> ) > > >> >> >> def pseudo(): > >> >> >> db.table.field.writable = False > >> >> >> db.table.field = 'some invalid value for the requires[]' > >> >> >> form = crud.create(db.table) > > >> >> >> the form doesn't run the validators for the non-writable field, and > >> >> >> when you are on GAE the uniqueness is not enforced on db level (and > >> >> >> DAL does not make up for this). > > >> >> >> When I have the following: > >> >> >> def pseudo(): > >> >> >> db.table.field = 'some invalid value for the requires[]' > >> >> >> form = crud.create(db.table) > >> >> >> form.custom.widget.jaar.update(**dict(_disabled = True)) > > >> >> >> the value is non-editable by the user, it is validated but the value > >> >> >> is removed --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---