Hello everyone, I am trying to fire a javascript by onclick event of submit button but not able to, Details of my code are "i have a button named filter and two text boxes which take the Id and Name, All i want is "When i enter the value in Id textbox and click Filter then i want the values to be displayed on URL using QueryString". here's the code..
print "<td><b>UserId</b></td><td><input type=\"text\" name=\"User_Id\"
value=\"" .$Id."\" size=\"6\" ></td>";
print "<td><b>UserName</b></td><td><input type=\"text\" name=\"User_Name\"
value=\"" .$Name ."\" size=\"10\"></td>";
print "<td><input type=\"submit\" name=\"Filter\" value=\"Filter\"
onClick=\"FilterExpression($Id,$Name)\"></td>";
After i click Filter this code gets executed..
if ( $q->param("Filter") )
{
$Id=$q->param('User_Id');
$Name=$q->param('User_Name');
if ($Id ne "" )
{
$filterexpression= $filterexpression." UserId like '" .$Id. "%' and " ;
}
if ($Name ne "" )
{
$filterexpression= $filterexpression." UserName like '" .$Name. "%' and " ;
}
}
The Javascript..
<script type="text/javascript">
function FilterExpression(Id,Name)
{
var val3=Id;
var val4=Name
window.location="List.cgi?Id="+val3+"&Name="+val4
}
</script>
Please Do help me out find the solution,Thank you.