Question, how could I make it so I don't have to click the submit button.
How could i make it to where they choose the files and it auto submits it?
On Wednesday, January 8, 2014 11:35:44 AM UTC-8, Brando wrote:
>
> This works, added the requires statement for form validation:
>
> def submit():
> import datetime
> form = FORM(LABEL("File(s):"), INPUT(_name='up_files', _type='file',
> _multiple='', requires=IS_NOT_EMPTY()), BR(),INPUT(_type='submit'))
> if form.accepts(request.vars, formname="form"):
> files = request.vars['up_files']
> if not isinstance(files, list):
> files = [files]
> for f in files:
> print f.filename
> up_file = db.uploads.up_file.store(f, f.filename)
> i = db.uploads.insert(notes=request.vars.notes,
> up_file=up_file, filename=f.filename, up_date= datetime.datetime.now())
> db.commit()
> return "form submitted" #redirect(URL('data', 'index'))
> return dict(form=form)
>
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.