popmotsy Posted July 9, 2009 Share Posted July 9, 2009 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> Quote Link to comment Share on other sites More sharing options...
trq Posted July 9, 2009 Share Posted July 9, 2009 What? Quote Link to comment Share on other sites More sharing options...
popmotsy Posted July 10, 2009 Author Share Posted July 10, 2009 hi,, i'll explain again. I am taking input thru barcode scanner, after scanning curser automatically move to next textbox,,right. Now , when i am takin array of textbox, after takin input,, cursor doesn't move to next textbox,, thats my problam,, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.