On Sep8, 1:58pm, weheh <richard_gor...@verizon.net> wrote: > In my example with 2 tables, table1 and table2, and one form, the form > only populates some of the fields in tables1 and 2. The rest of the > fields are ignored (to be filled out at a later date once more info > has been collected). However, these other fields have validators that > complain and tack on their error messages onto form.errors. > Consequently, the form.accepts fails. > > Is the only way to ignore these other fields to do the trick thing > described by Iceberg > (db.table1.field1.readable=db.table1.field1.writable=False), or is > there a cleaner way, like giving a list of fields? In my particular > case, I'm using SQLFORM.factory and custom forms in my html.
In fact I am facing exactly same demand as you. My approach is the readable=writable=False we mentioned earlier. Although it looks somewhat verbose and boring, but I think it is logically perfect. Besides, in this way, you usually don't need a customized view at all. That is also clean IMHO. And if you really want a cleaner way, here is what I did. I define a helper function as below. def adjust(#Just a helper table,**kwargs): for f in table.fields: table[f].readable=table[f].writable=False # reset for f in kwargs.get('readable',table.fields): table[f].readable=True for f in kwargs.get('writable',table.fields): table[f].writable=True --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" 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 -~----------~----~----~----~------~----~------~--~---