A SQLFORM.factory has no knowledge of the underlying database. If you
use SQLFORM.factory you should do the inserts/update manually.

In your case your form involves a single table so you should just use
crud.create or crud.update
use db.table.field.writable and db.table.field.readable and
db.table.field.default to change the behavior of the form.

On Oct 24, 3:02 pm, Renato-ES-Brazil <[email protected]> wrote:
> Massimo,
>
> I tried to use SQLFORM.factory just for tests:
>
> def edit():
>     task_id = request.args(0)
>     task=db(db.task.id==task_id).select()[0]
>     form=SQLFORM.factory(db.task.title, db.task.description,
> record=task)
>     if form.accepts(request.vars, session):
>         response.flash = 'form accepted'
>     elif form.errors:
>         response.flash = 'form has errors'
>     else:
>         response.flash = ''
>     return dict(form=form)
>
> The message "form accepted" was shown but the record was not updated.
> What should I do for work?
>
> On 24 out, 17:32, Thadeus Burgess <[email protected]> wrote:
>
> > >>>form=SQLFORM.factory(db.
>
> > > table1.field1,db.table2.field2)
>
> > Does this allow for the data to be inserted into the database? I would try
> > it right now but busy cleaning the home :)
>
> > -Thadeus
>
> > On Sat, Oct 24, 2009 at 1:35 PM, mdipierro <[email protected]> wrote:
>
> > > What is wrong with this?
>
> > > form=SQLFORM.factory(db.table1.field1,db.table2.field2)
>
> > > On Oct 24, 1:28 pm, Thadeus Burgess <[email protected]> wrote:
> > > > As far as [1], use custom form
>
> > > >http://web2py.com/AlterEgo/default/show/205
>
> > > > As far as [2], you could use SQLFORM.factory() or just a straight FORM()
> > > > object, and populate their default from the database, and on accepts you
> > > > would have to insert them seperately into the database.
>
> > > > I think this is a limitation of web2py that needs some work, Too often 
> > > > do
> > > I
> > > > have to break DRY just to get data from two tables into one form, its 
> > > > not
> > > > pretty, and difficult to maintain.
>
> > > > I find myself, almost not even using SQLFORM or CRUD anymore, just
> > > because I
> > > > need specific fine grained control.
>
> > > > -Thadeus
>
> > > > On Sat, Oct 24, 2009 at 1:22 PM, znafets <[email protected]> wrote:
> > > > > ot a table with user data and a table with address data referencing
> > > > > the user
> > > > > Now I would like to cre
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to