[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-25 Thread Cliff Kachinske
Graham, I have done form submission both ways. I much prefer self-submission. Much less code to write, so fewer opportunities for error. On Thursday, June 19, 2014 9:30:15 AM UTC-4, Graham Ranson wrote: > > I'm new to python and web2py...I have a small, but non-trivial, web > application and wa

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-25 Thread Anthony
> But there is one thing I did want to mention re. http://web2py.com/books/ > > default/chapter/29/07/forms-and-validators#Sharing-forms > . > > Indeed I did read > that section but it was the comment: > "Wha

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-25 Thread Graham Ranson
Thanks for all the replies - I'll close this particular discussion now and get on with writing some exploratory code, unfortunately, as always seems the case, the past week or so has had rather too many, apparently urgent, distractions... But there is one thing I did want to mention re. http:/

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-24 Thread Anthony
> > My experience in web-type applications is of the 'single purpose code' > type: one method assembles the data for the web page, from a database or > some default values etc., and then 'returns' it to the web client; then an > entirely separate method is the target for the subsequent HTML fo

Re: [web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-24 Thread Jim Steil
Yes, you set the defaults for the table before the form=SQLFORM(...) statement. All you are doing is setting a default, you are not 'prepopulating' data. Also, since web2py loads it's db.py on every request, the defaults you set in one request do not have an effect on subsequent requests. Also n

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-24 Thread Graham Ranson
Anthony writes: > > > It would probably help if you show some code, or at least explain in more detail an example where self submission is not possible or overly difficult. Note, your code can always distinguish between a form creation request and a form submission request by checking whethe

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-23 Thread Anthony
It would probably help if you show some code, or at least explain in more detail an example where self submission is not possible or overly difficult. Note, your code can always distinguish between a form creation request and a form submission request by checking whether request.post_vars is No

Re: [web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-23 Thread Jim Steil
I would handle setting defaults in the above example by setting the default value on the fields before the SQLFORM call like this: db.person.name.default = 'fieldvalue' -Jim On Mon, Jun 23, 2014 at 8:01 AM, Graham Ranson wrote: > Anthony writes: > > > If your going to use the web2py FORM or

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-23 Thread Graham Ranson
Anthony writes: > If your going to use the web2py FORM or SQLFORM functionality, then the same code both defines and processes the form, so self submission makes sense. If you would rather build all of your form creation and processing code from scratch, then sure, do whatever you want. Anthon

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-20 Thread Anthony
Self submission is also handy when you need to re-display a form with error messages after failed validation, as you avoid the need to do a redirect and store the validation errors in the session. Anthony On Friday, June 20, 2014 9:31:48 AM UTC-4, Anthony wrote: > > If your going to use the web

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-20 Thread Anthony
If your going to use the web2py FORM or SQLFORM functionality, then the same code both defines and processes the form, so self submission makes sense. If you would rather build all of your form creation and processing code from scratch, then sure, do whatever you want. Anthony On Friday, June

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-20 Thread Graham Ranson
Don O'Hara writes: > > Hi Graham - Welcome to web2py ! I think you'll find that this group > has many people who can share many types of design patterns. > Thanks for the replies... Just to mention the others: I had looked at Django and Turbogears briefly - Django certainly gets the most me

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-19 Thread Jim S
I too did a double-take when I first saw this concept when learning web2py some time ago. I came from a TurboGears environment and the self-submission was new to me. I didn't like it at first, but now couldn't image being required to do anything differently. Really simplifies/lessens the cod

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-19 Thread Anthony
Much of the code used to create the form is also re-used when it comes time to process the submitted form, so submitting back to the same action helps avoid code duplication. You also don't have to worry about explicitly specifying a URL for submission. In any case, self submission isn't necess