form=SQLFORM(db.person)
UPDATE FORM:
record=db(db.person.id==....).select()[0]
form=SQLFORM(db.person,record)
I guess you can combine them if this is what you are trying to do
(not sure it is a good idea)
records=db(db.person.name==request.vars.name).select()
form=SQLFORM(db.person,records[0] if len(records) else None)
On May 15, 2008, at 10:21 PM, g-man wrote:
>
> I can create my record with no problem...
>
> db.define_table('person', SQLField('name'))
> db.person.name.requires=IS_NOT_IN_DB(db, 'person.name')
>
> But, when I visit it on an edit form and try to 'Submit' with no
> change, web2py sees the original value in the database, thinks my
> 'Submit' is an attempt to create a new record with the same field
> value, and thus rejects the action.
>
> In other words, my field gets frightened of its own reflection in the
> mirror!
>
> What I need is a way to say, 'If this is an update of a record, it's
> OK to have the same value for a field.'
>
> How do I allow a no-change update in an existing field?
> >
Massimo
Massimo