[web2py] Re: How to use button instead of input in SQLForm
Hi, is there a way to simplify these expression: form[0][-1][1] ? Ok, I can assign these expression to a var. For a lot of questions regarding forms, there is form[0][-1][1] part of an answer. Thanks Andreas Am Samstag, 7. Juli 2012 02:38:04 UTC+2 schrieb Massimo Di Pierro: try form[0][-1][1].components = [ TAG.button('Upload', _id=px-submit,_type=submit), TAG.button('Clear',_id=px-clear,_type=reset), ] or you can use a custom form. On Friday, 6 July 2012 17:09:41 UTC-5, Andrew Evans wrote: Hello I am trying to figure out how to replace the submit button in SQLFORM I would like to replace with button id=px-submit type=submitUpload/button and add button id=px-clear type=resetClear/button My controller is def index(): form = SQLFORM(db.music2) if form.accepts(request.vars, session): #db.music2.insert(song = db.music2.song.store(request.vars.Filedata.file, request.vars.Filedata.filename)) response.flash = 'Your data has been submitted' elif form.errors: response.flash = 'Please correct the highlighted fields' return dict(form=form) else: return dict(form=form) return dict() Any ideas/advice is greatly appreciated :-)
[web2py] Re: How to use button instead of input in SQLForm
You can try replace form[0][-1][1] with form.element(_type='submit').parent On Saturday, July 7, 2012 3:19:02 AM UTC-5, Andreas Kaiser wrote: Hi, is there a way to simplify these expression: form[0][-1][1] ? Ok, I can assign these expression to a var. For a lot of questions regarding forms, there is form[0][-1][1] part of an answer. Thanks Andreas Am Samstag, 7. Juli 2012 02:38:04 UTC+2 schrieb Massimo Di Pierro: try form[0][-1][1].components = [ TAG.button('Upload', _id=px-submit,_type=submit), TAG.button('Clear',_id=px-clear,_type=reset), ] or you can use a custom form. On Friday, 6 July 2012 17:09:41 UTC-5, Andrew Evans wrote: Hello I am trying to figure out how to replace the submit button in SQLFORM I would like to replace with button id=px-submit type=submitUpload/button and add button id=px-clear type=resetClear/button My controller is def index(): form = SQLFORM(db.music2) if form.accepts(request.vars, session): #db.music2.insert(song = db.music2.song.store(request.vars.Filedata.file, request.vars.Filedata.filename)) response.flash = 'Your data has been submitted' elif form.errors: response.flash = 'Please correct the highlighted fields' return dict(form=form) else: return dict(form=form) return dict() Any ideas/advice is greatly appreciated :-)
[web2py] Re: How to use button instead of input in SQLForm
try form[0][-1][1].components = [ TAG.button('Upload', _id=px-submit,_type=submit), TAG.button('Clear',_id=px-clear,_type=reset), ] or you can use a custom form. On Friday, 6 July 2012 17:09:41 UTC-5, Andrew Evans wrote: Hello I am trying to figure out how to replace the submit button in SQLFORM I would like to replace with button id=px-submit type=submitUpload/button and add button id=px-clear type=resetClear/button My controller is def index(): form = SQLFORM(db.music2) if form.accepts(request.vars, session): #db.music2.insert(song = db.music2.song.store(request.vars.Filedata.file, request.vars.Filedata.filename)) response.flash = 'Your data has been submitted' elif form.errors: response.flash = 'Please correct the highlighted fields' return dict(form=form) else: return dict(form=form) return dict() Any ideas/advice is greatly appreciated :-)