View Single Post
  #1 (permalink)  
Old March 1st, 2011, 10:14 PM
newphpcoder newphpcoder is offline
Registered User
 
Join Date: Dec 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Function OnEnter Key

Good day!

I encountered problem in pressing enter key. After I insert data in lot/batch# and I pressed Enter Key, instead of going to time in textbox it was go to save button which is wrong.

Here is my code:
PHP Code:
<?php                      
                     
if($rexist == 0
                        { 
                        
$query "SELECT t.operation_name, t.input_unit, t.output_unit FROM trace_operations t WHERE t.plt_typeno = '" $_POST["plt_typeno"] . "'  AND t.operation_name IN ('01 Oper' , '02 Oper') ORDER BY t.operation_name"
                        
$result mysql_query($query); 
                        if(
$result
                            if(
$row mysql_fetch_array($result)) 
                                { 
                                     
                                echo 
"<p><center><b>OPERATOR AND MACHINE TRACEABILITY</center></b></p>"
                                echo 
"<table>"
                                echo 
"<tr> 
                                <th class='myclass'>OPERATIONS</th> 
                                <th class='myclass'>Time IN</th> 
                                <th class='myclass'>Time OUT</th> 
                                <th class='myclass'>INPUT <br/> QTY</th> 
                                <th class='myclass'>UNIT</th> 
                                <th class='myclass'>OUTPUT QTY</th> 
                                <th class='myclass'>UNIT</th> 
                                <th class='myclass'>ID #</th> 
                                <th class='myclass'>MC #</th> 
                                <th class='myclass'>VARIANCE Qty</th> 
                                <th class='myclass'>VARIANCE PLT #</th> 
                                <th class='myclass'>DATE</th> 
                                <th class='myclass'>SHIFT</th></tr>"

                                echo 
"\n\t<tr>"
                                echo 
"\n\t\t<td width='800'>"
                                if (
$last_operation_name != $row["operation_name"]) echo $row["operation_name"]; 
                                
$last_operation_name $row["operation_name"]; 
                                echo 
"<input type='hidden' width='400' name='opname[]' value='" $row["operation_name"] . "' /></td>";    
                                echo 
"\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" $ctr "' onkeypress='return handleEnter(event,\"timeout" $ctr "\");' /></td>"
                                echo 
"\n\t\t<td><input size='6' type='text' name='timeout[]' id='timeout" $ctr "' onkeypress='return handleEnter(event,\"inqty" $ctr "\");' /></td>"
                                echo 
"\n\t\t<td><input size='6' type='text' name='inqty[]' id='inqty" $ctr "' onkeypress='return handleEnter(event,\"outqty" $ctr "\");' /></td>"
                                echo 
"\n\t\t<td>" $row["input_unit"]; 
                                echo 
"<input type='hidden' name='iun[]' value='" $row["input_unit"] . "' /></td>"
                                echo 
"\n\t\t<td><input size='6' type='text' name='outqty[]' id='outqty" $ctr "' onkeypress='return handleEnter(event,\"idno" $ctr "\");' /></td>"
                                echo 
"\n\t\t<td>" $row["output_unit"]; 
                                echo 
"<input type='hidden' name='oun[]' value='" $row["output_unit"] . "'></td>"
                                echo 
"\n\t\t<td><input size='6' type='text' name='idno[]' id='idno" $ctr "' onkeypress='return handleEnter(event,\"mcno" $ctr "\");' /></td>"
                                echo 
"\n\t\t<td><input size='6' type='text' name='mcno[]' id='mcno" $ctr "' onkeypress='return handleEnter(event,\"varqty" $ctr "\");' /></td>"
                                echo 
"\n\t\t<td><input size='6' type='text' name='varqty[]' id='varqty" $ctr "' onkeypress='return handleEnter(event,\"varplt" $ctr "\");' /></td>"
                                echo 
"\n\t\t<td><input size='6' type='text' name='varplt[]' id='varplt" $ctr "' onkeypress='return handleEnter(event,\"dateshift" $ctr "\");' /></td>"
                                echo 
"\n\t\t<td><input size='6' type='text' name='dateshift[]' id='dateshift" $ctr "' onkeypress='return handleEnter(event,\"shift\");' /></td>"
                                echo 
"\n\t\t<td><input size='6' type='text' name='shift[]' id='shift" $ctr "' onkeypress='return handleEnter(event,\"saveform\");' /></td>"
                                echo 
"\n\t</tr>"
                                     } 
                                echo 
"</table>"
            } 
                echo 
"<p><input type='submit' value='Save' id='saveform' /></p>"
                echo 
"<input type='hidden' name='plt_typeno' value='" $_POST["plt_typeno"] . "' />"
        } 
        } 
        } 
        
?> 
</form> 
<form name="enumplt" action="yield_station1.php" method="post"> 
<input type="hidden" name="enum_plt" value="1" /> 
<input type="hidden" name="plt_typeno" /> 
</form> 
</body> 
</html>
Reply With Quote