if form.accepted:
SQLFORM.grid(..., formargs=dict(message_onsuccess='form accepted',
message_onfailure='form has errors'))
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/2ikYrc84qB4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
Lep pozdravVid Ogris
form = grid.element('.web2py_form')
if (grid_shifts.create_form and grid_shifts.create_form.errors) or (grid_shifts.update_form and grid_shifts.update_form.errors):
codeField = grid_shifts.element('input[name=sh_code]')['value']
shiftId = db(db.shifts.sh_code == codeField).select(db.shifts.id).as_list()
redId = shiftId[0]["id"]
URL('turnusi/edit/shifts', args= redId)
'static','js/web2py-bootstrap3.js'
session.flash= A(T("Click here if you want to activate shift with that code or if you want to be redirected to the shift."), _href=URL('turnusi/edit/shifts', args= redId))
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
--
Lep pozdravVid Ogris
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/2ikYrc84qB4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
--
Lep pozdravVid Ogris
HelloI have a new problem with my forms.I have validators on the fieldsBut looks like they are not triggered, so for exampleWhen I insert a new record a first check should be done on the fields like is_not_empty etc.Then if that is all ok it has to check the field sh_code and if this code already exist in the database i want a redirect linkso far the link and everything works ok, but the first validators are not working so i get an error cos the sh_.field which is autogenerate is not donethis is the part of the code that creates a link for flash msg
if (grid_shifts.create_form and grid_shifts.create_form.errors) or (grid_shifts.update_form and grid_shifts.update_form.errors):
codeField = grid_shifts.element('input[name=sh_code]')['value']
shiftId = db(db.shifts.sh_code == codeField).select(db.shifts.id).as_list()
redId = shiftId[0]["id"]
URL('turnusi/edit/shifts', args= redId)
'static','js/web2py-bootstrap3.js'
session.flash= A(T("Click here if you want to activate shift with that code or if you want to be redirected to the shift."), _href=URL('turnusi/edit/shifts', args= redId))validatorsdb.shifts.sh_name.requires = [IS_NOT_EMPTY(error_message=T('Missing shift name'))]db.shifts.sh_color.requires = [IS_NOT_EMPTY(error_message=T('Missing shift color'))]db.shifts.sh_start1.requires = [IS_NOT_EMPTY(error_message=T('Missing start time of the shift'))]db.shifts.sh_end1.requires = [IS_NOT_EMPTY(error_message=T('Missing end time of the shift'))]
so far the link and everything works ok, but the first validators are not working so i get an error cos the sh_.field which is autogenerate is not done
if (grid_shifts.create_form and grid_shifts.create_form.errors) or (grid_shifts.update_form and grid_shifts.update_form.errors):
form = grid_shifts.create_form or grid_shifts.update_form
if form and form.errors:
codeField = grid_shifts.element('input[name=sh_code]')['value']
codeField = form.vars.sh_code
shiftId = db(db.shifts.sh_code == codeField).select(db.shifts.id).as_list()
redId = shiftId[0]["id"]
redId = db(db.shifts.sh_code == codeField).select().first().id
session.flash= A(T("Click here if you want to activate shift with that code or if you want to be redirected to the shift."), _href=URL('turnusi/edit/shifts', args= redId))
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/2ikYrc84qB4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
Many thanks to you guys for answering so many user questions. I am finding it really helpful.