Complete newbie to web2Py.... I have a web page that has a dropdown menu and I want to perform certain queries based on the value selected.
Reports.html
<h2>Reports</h2>
<p>Please select a report template or choose to write your own.</p>
<select id="ReportSelect" onchange="ReportSelectionChange()">
<option disabled selected value="0"></option>
<option value="1">option 1</option>
<option value="2">option 2</option>
</select>
<script language="javascript" type="text/javascript">
function ReportSelectionChange()
{
var menuItem = document.getElementById("ReportSelect").value;
switch(menuItem)
{
case "1":
{{=myform}}
break;
case "2":
default:
alert(menuItem);
break;
}
}
controller python file
def reports():
user_id = request.args(0)
tuple = db(/*My query here*/).select()
myform = FORM('/*not sure what goes here*/')
return dict(tuple=tuple, myform=myform)
I want to pass back all the results from the query to the calling page and have the results appear in a table.
Q: How can I do this? what needs to get passed back? can this even be accomplished with javascript?