Thanks alot Javier, it worked On Sunday, October 22, 2017 at 4:16:57 PM UTC+2, Javier Pepe wrote: > > Hi > > You can fill the record before SQLFORM > > def marks_entry(): > stu=db.student(request.args(0)) > > * db.marks.students.default = stu.id <http://stu.id>* > form=SQLFORM(db.marks) > return locals(); > > 2017-10-22 8:59 GMT-03:00 mostwanted <godir...@gmail.com <javascript:>>: > >> Hi guys, i need help, I'm creating a simple results management system for >> a school and I've hit a stumbling block, what i wanna do is be able to open >> a form to make detail entries of a specific individual and this is how i >> want to do it, i wanna click on the specific individual's name and have >> that form open up with the name of that person pre-selected so i don't have >> to go through a large list of too many students looking for one student & >> have other fields empty and all i have to do is fill up those fields, >> fields like marks for the subjects. PLEASE HELP, I'M REALLY STUCK! >> >> My application is straight forward and to the point and so is its code: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *MODELSdb.define_table('student_class', >> Field('class_name', requires=IS_NOT_EMPTY()), >> Field('teacher', 'reference teacher'), >> format='%(class_name)s')db.define_table('student', >> Field('surname', requires=IS_NOT_EMPTY()), Field('name', >> requires=IS_NOT_EMPTY()), Field('photo', 'upload', >> requires=IS_NOT_EMPTY()), Field('class_name', 'reference >> student_class'), Field('dob', 'date', >> requires=IS_NOT_EMPTY()), >> format='%(surname)s')db.define_table('subject', >> Field('subject_name', requires=IS_NOT_EMPTY()), >> format='%(subject_name)s')#I WANT THIS TABLE TO BE OPEN WHEN I CLICK ON A >> NAME BUT WITH THAT NAME AND PRE-SELECTED WITH ONLY SOME FIELDS LEFT EMPTY >> SO I DONT #HAVE TO GO THROUGH A LIST OF 100 LOOKING FOR ONE >> STUDENT.db.define_table('marks', Field('student', 'reference >> student'), Field('subject', 'reference >> subject'), Field('term', >> requires=IS_NOT_EMPTY()), Field('marks', 'integer', >> requires=IS_NOT_EMPTY()), Field('total', 'integer', >> requires=IS_NOT_EMPTY()), >> Field('comments',type='text',requires=IS_NOT_EMPTY()), >> )CONTROLLERdef student_class(): >> classes=db.student_class(request.args(0)) >> student=db(db.student.class_name==classes.id >> <http://classes.id>).select(orderby=db.student.surname) >> head=db(db.letter_head).select(db.letter_head.ALL) return >> locals()VIEW<div id="container"><h2> CLASS: >> {{=classes.class_name}}</h2><br /> <div class="classes" >> style="margin-left: 15px;"> SURNAMES (A-E)<hr />{{letters=['A', 'B', >> 'C', 'D', 'E', 'F']for stu in student: if stu.surname[0] in >> letters: stu.surname}}{{=A('Report', _href=URL('genrate_report', >> args=stu.id <http://stu.id>))}} | <span >> class="name">{{=stu.surname}}</span> | {{=A('Marks', >> _href=URL('marks_entry', args=stu.id <http://stu.id>))}}<br >> />{{pass}}{{pass}}</div>CONTROLLER* >> >> >> >> >> >> >> >> >> >> *#I DO NOT KNOW WHAT TO ENTER IN THE BELOW FUNCTION TO MAKE IT DO WHAT I >> WANT IT TO DO!!!!def marks_entry(): form=SQLFORM(db.marks) return >> locals();VIEW{{extend 'layout.html'}}{{=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 web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > >
-- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.