Hi, the following works fine when there is no symbol such as "&" in the
field value. How can we pass and receive the parameters which contains
"&"..etc.?
View - customer_index
<td class="row_buttons"><a href="{{=URL('customer_view',args=
[list.TKDIID,list.TKDICD])}}" class="btn"><i class="icon-search"></i>
View</a>
Controller - default.py
def customer_index():
response.title = 'List'
response.subtitle = 'Customer Code'
form=SQLFORM.factory(Field('search'))
form.custom.widget.search['_class'] = 'input-medium search-query'
form.custom.submit['_value'] = 'Search'
form.custom.submit['_class'] = 'btn'
if form.accepts(request):
key=form.vars.search.upper() + "%"
query = (db.EDXTKF00.TKDIID.like(key)) |
(db.EDXTKF00.TKDICD.like(key))
else:
query = db.EDXTKF00.TKDIID!=""
# Paging plugin
paginate_selector = PaginateSelector(anchor='main')
paginator = Paginator(paginate=paginate_selector.paginate,
extra_vars={'v':1}, anchor='main',
renderstyle=True)
paginator.records = db(query).count()
paginate_info = PaginateInfo(paginator.page, paginator.paginate,
paginator.records)
# End Paging plugin...
lists=db(query).select(db.EDXTKF00.TKDIID,db.EDXTKF00.TKDICD,db.EDXTKF00.TKTKSC,db.EDXTKF00.TKTKCD,db.EDXTKF00.TKDMCD,orderby=[db.EDXTKF00.TKDIID,db.EDXTKF00.TKDICD],limitby=paginator.limitby())
return
dict(form=form,lists=lists,paginator=paginator,paginate_selector=paginate_selector,
paginate_info=paginate_info)
def customer_view():
response.title = 'View'
response.subtitle = 'Customer Code'
request.args(0) or redirect (URL('customer_index'))
record = db.EDXTKF00(db.EDXTKF00.TKDIID==request.args(0) and
db.EDXTKF00.TKDICD==request.args(1))
if record != None:
form = SQLFORM(db.EDXTKF00,record, readonly=True)
else:
redirect(URL('customer_index'))
return dict(form=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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/a8442abb-62cf-47fc-aa32-826bbe571af0n%40googlegroups.com.