On Tue, Feb 23, 2010 at 07:47, hamdy.a.farag <hamdy.a.fa...@inbox.com> wrote:
> can't get it sorry !!
>
> is not there a special form variable that distinguishes between
> insertion and update ?

When you show the form, the SQLFORM object is created with or without
the register/row param. When you submit the form, you should verify
the form object with form.accepts().
The method accepts verify if you created the form for create a row, like:
form = SQLFORM(db.my_table)
or if you want to change a record:
form = SQLFORM(db.my_table, my_record)
So, the method accepts can access "self.record" and verify if it
exists (if no it is a create form, if yes it is an update form).
See the code of class SQLFORM at gluon/sqlhtml.py so you can understand more.

> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@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.
>
>



-- 
Álvaro Justen - Turicas
 http://blog.justen.eng.br/
 21 9898-0141

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@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.

Reply via email to