Hello All,
I have one question regarding putting one single button for multiple
forms...
At present I have 4 form and its corresponding submit buttons. Now I would
like to have single button instead of four...
I would like have a submit button which submit only those user entered
value in specific form(first, second, third or fourth form).
Please help me out with my code:
def index():
values= ['','P2', 'P3', 'P8', 'P9', 'P10', 'P14', 'P15', 'P16', 'P17',
'P24']
protease = FORM('Select
prot:',SELECT(values,_name='protease',_onchange="jQuery.post('%s',{'protease':jQuery(this).val()})"
% URL('mmp')))
#first form
uniprot = FORM('Uniprot ID:',INPUT(_name='uniprot',
requires=IS_NOT_EMPTY()),
INPUT(_type='submit',_value='Submit uniprot query'))
#second form
fasta = FORM('Enter fasta sequence:',TEXTAREA(_name='fasta',
requires=IS_NOT_EMPTY()),
INPUT(_type='submit',_value='Submit fasta query'))
#third form
pdbfile = FORM('Choose PDB file:',INPUT(_type='file', _name='pdbfile',
requires=IS_NOT_EMPTY()),
INPUT(_type='submit',_value='Submit PDB query'))
#fourth form
pdbid = FORM('Enter PDB ID:',INPUT(_name='pdbid',
requires=IS_NOT_EMPTY()),
INPUT(_type='submit',_value='Submit PDB ID query'))
if uniprot.process(formname='uniprot').accepted:
session.uniprot = uniprot.vars.uniprot
redirect(URL('result'))
else:
response.flash = 'please enter valid uniprot id'
if fasta.process(formname='fasta').accepted:
session.fasta = fasta.vars.fasta
redirect(URL('blast_result'))
else:
response.flash = 'please enter fasta sequence'
if pdbfile.process(formname='pdbfile').accepted:
session.pdbfile = pdbfile.vars.pdbfile.file.read()
redirect(URL('pdbfile_result'))
else:
response.flash = 'please choose PDB file'
if pdbid.process(formname='pdbid').accepted:
session.pdbid = pdbid.vars.pdbid
redirect(URL('pdbid_res'))
else:
response.flash = 'please enter PDB ID'
return dict(uniprot=uniprot, fasta=fasta, protease=protease,
pdbfile=pdbfile, pdbid=pdbid)
--
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.