This only seems to happen when I run a local copy of my appliance, but here
it goes.
First the code:
controller:
def submit_answer():
session.incorrect = False
points = 0
responsejs=False
tabTracker = False
sound = None
answer=FORM('Answer: ',
INPUT(_name='answer', requires=IS_NOT_EMPTY()),
INPUT(_type='submit', _class='btn btn-primary',
_id="sub_button",_value="submit"))
if answer.process(message_onsuccess='').accepted:
answer_comp =
db(db.questions.id==int(request.vars['chal'])).select(db.questions.ALL).first()
if answer.vars['answer'] == answer_comp['answer']:
response.flash = 'Correct!'
redirect(
request.env.http_web2py_component_location,client_side=True)
else:
session.incorrect = True
redirect(
request.env.http_web2py_component_location,client_side=True)
response.flash = 'Incorrect answer'
elif answer.errors:
response.flash = ''
else:
response.flash = ''
return dict(answer=answer)
view:
{{=LOAD('board','submit_answer.load',
vars={'chal':question['id']},ajax=True)}}
-----------------------------end code----------------
When I click submit while using the appliance locally the button does a
quick flash/glitch and my input vanishes, but when I click on submit again
the input is submitted properly. In other words, I have to click submit
twice for my button to work.
The version I have posted on the web works fine (submits on the first try).
Could this have something to do with accessing the server through a local
ip? (127.0.0.1) That is the only difference I can spot out
--
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/d/optout.