Forum Moderators: coopster
in this piece of code i would like to call a javascript function from php:
if (isset($_GET['ord']) && isset($_GET['type'])) {
//check if a reload of the select boxes is necessary
echo '<script language="javascript">orderReportsReload()</script>';
but the function doesn't get called :(
[edited by: kristof_v at 9:40 am (utc) on Dec. 1, 2006]
this is the functiuon:
function orderReportsReload() {
alert("test");
var ordername = document.listReportsForm.selectOrderName.options[document.listReportsForm.selectOrderName.selectedIndex].value;
var ordertype = document.listReportsForm.selectOrderType.options[document.listReportsForm.selectOrderType.selectedIndex].value;
window.location = "index.php?page=reports/list_all&ord=" + ordername + "&type=" + ordertype;
}
in another functio i already use
var ordername = document.listReportsForm.selectOrderName.options[document.listReportsForm.selectOrderName.selectedIndex].value;
var ordertype = document.listReportsForm.selectOrderType.options[document.listReportsForm.selectOrderType.selectedIndex].value;
window.location = "index.php?page=reports/list_all&ord=" + ordername + "&type=" + ordertype;
and there it works great so i don't get it
<form method="get" action="index.php">
<select name="ord">
...blah blah blah...
</select>
<select name="type">
...blah blah blah...
</select>
<input type="hidden" name="page" value="reports/list_all" />
<input type="submit" />
</form>
Not sure if this fits into your page or not, but it seems like a reasonable solution instead of making it more difficult for yourself with JavaScript. ;)
Good luck!