Dear All. I am trying get records from a form like this:
controller: def llamados(): import time hoy=time.time() desde=time.strftime('%Y-%m-%d 00:00:00',time.localtime(hoy)) hasta=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(hoy)) lineas=db(db.accountcode.id_clientes==session.cliente_id).select(db.accountcode.ALL,orderby=db.accountcode.ani) #print lineas if len(lineas) > 1: acc=['Todas'] else: acc=[] for l in lineas: acc.append(l.ani) form=FORM(TABLE(TR("Desde ( Año-mes-día ):",INPUT(_type="datetime",_name="desde",_value=desde,_class='datetime',_id="datetlimite", requires=IS_DATETIME())), TR("Hasta ( Año-mes-día ):",INPUT(_type="datetime",_name="hasta",_value=hasta,_class='datetime',_id="datetlimite1", requires=IS_DATETIME())), TR("Lineas",SELECT(acc,_name="linea",requires=IS_IN_SET(acc))), TR("",INPUT(_type="submit",_value="Consultar")))) if form.accepts(request.vars,session): a=db.llamados b=db.accountcode.with_alias('b') c=db.clientes.with_alias('c') if form.vars.linea=="Todas": query = (b.id_clientes==session.cliente_id)&(a.dialstatus=='ANSWER')& (a.inicio>=form.vars.desde)&(a.inicio<=form.vars.hasta) left = (b.on(a.id_accountcode==b.id),c.on(b.id_clientes==c.id)) rows = db(query).select(b.ani,a.destino,a.answeredtime,a.inicio,a.fin,a.valor,left=left,orderby=~a.inicio) totalrecs=len(rows) else: lin=db(db.accountcode.ani==form.vars.linea).select(db.accountcode.ALL)[0] query = (b.id_clientes==session.cliente_id)&(a.dialstatus=='ANSWER')& (a.inicio>=form.vars.desde)&(a.inicio<=form.vars.hasta) & (a.id_accountcode==lin.id) left = (b.on(a.id_accountcode==b.id),c.on(b.id_clientes==c.id)) rows = db(query).select(b.ani,a.destino,a.answeredtime,a.inicio,a.fin,a.valor,left=left,orderby=~a.inicio) return dict(form=form,rows=rows,vars=form.vars) View: llamados.html {{extend 'layout.html'}} <h2>Registro de Llamados</h2> {{=form}} {{if rows:}} {{=TABLE(TR(rows))}} 1) My first problem is when i change date and press button, the values of the desde, hasta and lineas is reinicializated in the view. 2) How i can show records and paginate too. I am trying using the code of http://mdp.cti.depaul.edu/AlterEgo/default/show/95 3) I want know using Ajax. Anyone could me explain how i can doing this code using Ajax?. Fernando. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---