I have a really stupid problem with checkboxes in web2py, i cant get the
value once a form submit, this is my code:
A javascript modal that show the form
x
Editar pregunta:
{{for q in questions:}}
Orden (lugar dentro del formulario):
Pregunta:
Ayuda:
Obligatorio:
Mas de un autor:
Mostrar en resumen a usuario:
Mostrar en resumen a administrador:
{{pass}}
Guardar
cambios
Cerrar
And the code to save the info in the database:
@auth.requires_membership('admin')
def save_contest_template():
contest_id = request.args[0]
questions_db =
db(contest_id==db.contest_field.contest).select(db.contest_field.ALL)
for q in questions_db:
var = "question-" + str(q['id'])
if request.vars[var] != "":
q.update_record(name=request.vars[var])
var = "help-"+ str(q['id'])
if request.vars[var] != "":
q.update_record(help=request.vars[var])
var = "t_order-"+ str(q['id'])
if request.vars[var] != "":
q.update_record(t_order=request.vars[var])
var = "required-"+ str(q['id'])
try:
if request.vars[var] is not None:
q.update_record(is_required=True)
except KeyError ,e:
q.update_record(is_required=False)
var = "authors-"+ str(q['id'])
try:
if request.vars[var] is not None:
q.update_record(many_authors=True)
except KeyError ,e:
q.update_record(many_authors=False)
var = "user_summary-"+ str(q['id'])
try:
if request.vars[var] is not None:
q.update_record(user_summary=True)
except KeyError ,e:
q.update_record(user_summary=False)
var = "admin_summary-"+ str(q['id'])
try:
if request.vars[var] is not None:
q.update_record(admin_summary=True)
except KeyError ,e:
q.update_record(admin_summary=False)
redirect(URL('contestedit?contest='+contest_id+'&activeTab=2'))
it works fine for the non checkbox values, but i cant get the checked state
from checkboxes, i google a litle and find that the checkboxes should have
value='on' when they are checked, but thats not working for me either
--
---
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/groups/opt_out.