On 08/26/2010 05:52 AM, mdipierro wrote:

On Aug 25, 11:47 pm, Gary<gher...@digipen.edu>  wrote:
I'm a experienced Python programmer (15+ years), but mostly new to web
programming and just several days into my first web2py application.

Several questions have come up:

1.  On SQLFORM and CRUD forms, is there a way to get a cancel button
displayed next to the submit buttons?
I usually do something like this:

<script>
jQuery('input[type=submit]').after('<button onclick="document.location=
\'{{=URL('problem',args=form.record.id)}}\';return
false">cancel<button>');
</script>

Lovely... Once I got rid of the email-induced line breaks. (And figured out where to put it. :-) )



2.  If I want to pre-fill several fields in a form, I know how to do
it with SQLFORM and an assignment like form.vars.xxx=yyy, but is there
such a feature for CRUD forms?
Do not do that. user default instead before SQLFORM. For create forms:
db.mytable.byfield.default=yyyy
For update forms:
db.mytable.byfield.update=yyyy

Thanks... I'll gladly use the default because it seems cleaner, and works for crud forms.

However, the form I used (the form.vars.xxx=yyy) comes directly out of the book. (A section named *Pre-populating the form*.)* * Should that be updated?
*
*

--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418

Reply via email to