I'm able to pass a value from the select/option to div but I can't seem to
get a way of sending the same value to controller(then database). I have
tried different AJAX methods but they seem not to pass the variables to
controller.
How do I get it to be done?
So far this is my code:
def insert_task():
"""an ajax callback that returns a <ul>"""
task_name = request.vars.name
pp = []
pp.append(task_name)#db.mylist.insert(task=task_name)
return pp
<div id="target">
<form action="" enctype="multipart/form-data" method="post" class="hidden">
<select name="search_category" question="What is your age range?">
<option value="<39">Below 39 yrs</option>
<option value="40-54">40 to 64 yrs</option>
<option value=">65">Above 65 yrs</option>
</select>
<select name="search_category" question="What is the choice of your
books?" >
<option value="1">Non-Fiction</option>
<option value="2">Fiction</option>
<option value="3">Childrens</option>
<option value="4">Biography</option>
</select>
</form>
<script>
//$('#ddlViewBy option:selected').text()
$('#ddlViewBy').change(function(){
alert($(this).val());
$("#target").text($(this).val());//working
});
</script>
--
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/026e82e6-c245-4146-8f5a-6cb27187c372%40googlegroups.com.