Another extrange behaviour I noted is in T3. 1) I defined a table and I inserted a value in a int record.
2) I noted I was worng with the type field, I wanted a string, so I deleted the record and redefined type field in define_table 3) I changed the type of record from int to string, web2py respoonded me OK 4) reallyr web2py doesn't changes type field, but models has type string at define_table I had to use SqliteManager to change table. On 28 mayo, 17:55, Iceberg <[email protected]> wrote: > Hello Massimo, > > This proposal tries to address the last point mentioned in [1], quoted > below. > > "...... when deleting a record, form variables should be cleared > which is not the case here. In my openion this’s not a good idea in > fact, and needs to be fixed because it’s really tempting to see the > variables still in the form and makes one clicks the ['submit'] button > again to see what would happen and it returns ‘object not found’ error > message." > > An easy idea, which was also suggested in [1], is to use redirect(...) > after successful record deletion. But that is not one-size-fits-all > because developers need to provide target URL in every case. > > Then I planned to somehow compulsively replace the form object with a > string such as "delete ok", but it would cause backward compatibility > problem when a customized view file expecting a real form object. > > Finally I got the idea. SQLFORM.accepts() can disable all form fields > after deletion, to indicating a successful deletion and also avoid > further operation! crud also benefits from this improvement. Try the > patch. > > From line 920 of sqlhtml.py: > > if record_delete: > ...... > self.errors.clear() > > self.components.append(SCRIPT("""jQuery(document).ready(function(){ > jQuery('input, select').attr('disabled', > 'disabled'); })""", > _type="text/javascript")) # to emphasize the record is > deleted and avoid further operation > return True > > [1]http://web2py.wordpress.com/2010/05/02/record-deletion-and-keepvalues... > > Sincerely, > Iceberg, 2010-May-28, 03:07(AM), Fri

