Jump to content

problam,,help


popmotsy

Recommended Posts

hi guys,,

 

first see my code,,

 

I m takin input in textbox

 

("cid0,cid1,cid2...cid50..name of texbox")

 

using barcode scanner,,after scanning,cursor moves to next textbox

 

now if i change name of textbox mak them array,that means

 

cid[],cid[],cid[]....and so on,,then cursor doesnot move.

 

but here i hav to make them array,,and how can i mov cursor to next field...plz help...

 

 

 

 

<script type="text/javascript" >

function handleKeyPress(e,fldobj,nbox)
{
var key=e.keyCode || e.which;
if (key==13)
{
	event.cancelBubble = true; //Both lines stops auto submistion
	event.returnValue = false; //  by pressing ENTER (submit) button
	//alert (nbox);
	var next=fldobj.tabIndex; // this will grap the tabindex of the object passed to variable 'next'
	//alert (next);
	//alert (next);
	var nN='cid';		// 'nN' is a placeholder for storing the lable of first field 'cid'
	nN=nN+next;	// now both var concatinates for the creation of final text box name like 'cid0' 'cid1'
	//alert (nN);
	document.myform.elements[nN].focus(); // it will rotet the focus to the next element (textbox)
}

}
</SCRIPT> 


<?php require_once("include/top.php"); ?>
<?php require_once("include/left.php"); ?>   

<table align="center"><th align="center"> POD Entries</th></table>      





<table border="0" width="100%">
    <TR>
        <TD width="100%" align="center">
        <form name="myform" method="post" action="validpod.php" >
        <table align="center" border="1" style="font-size:12">
            
         <TR> 
                      <th align="center" >Barcode No</th> 

                      <th align="center" >POD No.</th> 

                      
	   </TR> 
            
<tr>
<td width="16%"  ><input type="text" name="cid0" size="16" tabindex="1" onkeypress="handleKeyPress(event,this,id);" ></td>
<td width="17%"><input type="text" name="podno[]"  tabindex="50" size="17"></td>
</tr>

<tr>
<td width="16%"><input type="text" name="cid1" size="16" tabindex="2" onkeypress="handleKeyPress(event,this,id);" ></td>
<td width="17%"><input type="text" name="podno[]"  tabindex="51" size="17"></td>

</tr>

<tr>
<td width="16%"><input type="text" name="cid2" size="16" tabindex="3" onkeypress="handleKeyPress(event,this,id);" ></td>
<td width="17%"><input type="text" name="podno[]"  tabindex="52" size="17"></td>

</tr>

 

 

Link to comment
https://forums.phpfreaks.com/topic/165329-problamhelp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.