On Fri, Aug 14, 2009 at 2:00 AM, Yarko Tymciurak <yark...@gmail.com> wrote:

> Hi weheh -
>
> Thanks for asking this - it was a good review of the draft of the book:
>
>
> On Fri, Aug 14, 2009 at 12:10 AM, Yarko Tymciurak <yark...@gmail.com>wrote:
>
>> try form.vars.filename.new_filename
>
>
> try form.vars.filename_newfilename
>
>
>> the pattern is:
>>
>> form.vars.<upload fieldname>.new_filename
>
>
> the CORRECT pattern (as it behaves) is:
>
>    form.vars.<upload fieldname>_newfilename
>
> I have working code if you need it - let me know;
>
> - Yarko
>

For anybody that cares to replicate, I viewed the accepted form.vars in
WingIDE;  I copied this from the form examples,
added weheh's line and inserted it in my welcome controllers/default.py:

def upload():
    form = SQLFORM.factory(Field('filename','upload'))
    if form.accepts(request.vars, session):
        response.flash = 'form accepted; uploaded %s' %
form.vars.filename_newfilename
    elif form.errors:
        response.flash = 'form is invalid'
    else:
        response.flash = 'please fill the form'
    return dict(form=form, vars=form.vars)


Regards,
- Yarko

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