javascript - Event on change -
javascript - Event on change -
i have this:i want when select thing on dropdown list submitt button should fired... have added onchange event i.e onchange go function in have called form using document.getelementbyid("frmreport").submit();
<script type = "text/javascript"> function go() { document.getelementbyid("frmreport").submit(); } </script>enter code here </head> <body id="homepage"> <!-- right side/main content start --> <div id="rightside"> <!-- graphs box start --> <div class="contentcontainer" id="graphs"> <div class="contentbox" id="graphs-1"> <form name="frmreport" id="frmreport" method="post"> <table style="display: none;" class="area"> <caption>voice-sms sent</caption> <thead> <tr> <td></td> <th scope="col">1</th> <th scope="col">2</th> <th scope="col">3</th> <th scope="col">4</th> <th scope="col">5</th> <th scope="col">6</th> <th scope="col">7</th> <th scope="col">8</th> <th scope="col">9</th> <th scope="col">10</th> <th scope="col">11</th> <th scope="col">12</th> <th scope="col">13</th> <th scope="col">14</th> <th scope="col">15</th> <th scope="col">16</th> <th scope="col">17</th> <th scope="col">18</th> <th scope="col">19</th> <th scope="col">20</th> <th scope="col">21</th> <th scope="col">22</th> <th scope="col">23</th> <th scope="col">24</th> <th scope="col">25</th> <th scope="col">26</th> <th scope="col">27</th> <th scope="col">28</th> <th scope="col">29</th> <th scope="col">30</th> </tr> </thead> <tbody> <tr> <th scope="row">toatal calls</th> <?php if (isset($_post['submit'])) { $answer = array(); for($i=1;$i<=31;$i++) { $answer[$i]=0; } $connect = new connection(); if ($connect->openconnection()) { $connect->begintransaction(); $filecount = $connect->fetchrows("call sptotalvoicemonthgraphstatus('shreeweb','".date("y")."-".$_request['cmbtoyear']."-01')"); //$rowcount=count($filecount); //echo $rowcount; if ($filecount) { foreach($filecount $row) { //$abc=$row['count']; //echo '<td>'.$row['count'].'</td>'; $answer[$row['actualdate']]=$row['count']; } } } for($i=1;$i<=31;$i++) { echo '<td>'.$answer[$i].'</td>'; } } ?> </tr> <tr> <th scope="row">answered calls</th> <?php if (isset($_post['submit'])) { $answer = array(); for($i=1;$i<=31;$i++) { $answer[$i]=0; } $connect = new connection(); if ($connect->openconnection()) { $connect->begintransaction(); $filecount = $connect->fetchrows("call spmonthlygraphstatus('shreeweb','".date("y")."-".$_request['cmbtoyear']."-01')"); //$rowcount=count($filecount); //echo $rowcount; if ($filecount) { foreach($filecount $row) { //$abc=$row['count']; //echo '<td>'.$row['count'].'</td>'; $answer[$row['actualdate']]=$row['count']; } } } for($i=1;$i<=31;$i++) { echo '<td>'.$answer[$i].'</td>'; } } ?> </tr> <tr> <th scope="row">other calls</th> <?php if (isset($_post['submit'])) { $answer = array(); for($i=1;$i<=31;$i++) { $answer[$i]=0; } $connect = new connection(); if ($connect->openconnection()) { $connect->begintransaction(); $filecount = $connect->fetchrows("call spmonthlygraphstatusothers('shreeweb','".date("y")."-".$_request['cmbtoyear']."-01')"); if ($filecount) { foreach($filecount $row) { $answer[$row['actualdate']]=$row['count']; } } } for($i=1;$i<=31;$i++) { echo '<td>'.$answer[$i].'</td>'; } } ?> </tr> </tbody> <center> <select size="1" name="cmbtoyear" id="cmbtoyear" title="click here select year" onchange = "go()"> <option>select month</option> <option value="01">jan </option> <option value="02"> feb</option> <option value="03"> mar</option> <option value="04"> apr</option> <option value="05"> may</option> <option value="06"> jun</option> <option value="07"> july</option> <option value="08"> aug</option> <option value="09"> sep</option> <option value="10"> oct</option> <option value="11"> nov</option> <option value="12 "> dec</option> </select> <input type="submit" class="btn" value="submit" name="submit" title="click here view reports sent voice sms"> </center> </table> </form> </div> </div>
the naming of button interfering script
onchange="this.form.submit()"
work if rename submit button mysubmit.
also there no jquery involved @ removed tag.
if want jquery, do
$(function() { $("#cmbtoyear").on("change",function() { this.form.submit(); // or $("#frmreport").submit(); }); });
but renaming of button of import need
if (isset($_post['mysubmit']))
javascript
Comments
Post a Comment