954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

onchange input field focus on other input field

Hello, does anyone know a simple way to focus on a different text field after the user enters data in the first text field? Thanks.

brynFlew
Junior Poster in Training
59 posts since Jan 2011
Reputation Points: 27
Solved Threads: 1
 

I was able to accomplish this using

<script>
function check()
{
var letters = document.inputData.swipeCard.value.length +1;
if (letters <= 6)
{document.inputData.swipeCard.focus()}
else
{document.inputData.workArea.focus()}
}

function check2()
{
var letters2 = document.inputData.workArea.value.length +1;
if (letters2 < 1)
{document.inputData.workArea.focus()}
else
{document.inputData.partNumber.focus()}
}

function check3()
{
var letters3 = document.inputData.partNumber.value.length +1;
if (letters3 <= 4)
{document.inputData.partNumber.focus()}
else
{document.inputData.quantity.focus()}
}

  </script>

and

onKeyUp="check()"
onKeyUp="check2()" ..
brynFlew
Junior Poster in Training
59 posts since Jan 2011
Reputation Points: 27
Solved Threads: 1
 

now if only i knew how to change the field depending if the field is null or not because i am using a barcode scanner and want to auto tab after every scan, i cannot seem to get this part working, any advice?

brynFlew
Junior Poster in Training
59 posts since Jan 2011
Reputation Points: 27
Solved Threads: 1
 

can you use onchange instead of onkeyup?

SolidSolutions
Junior Poster
136 posts since Jul 2010
Reputation Points: 24
Solved Threads: 24
 

ive tried that unfortunately the onchange only seems to work when i click outside the input field, ive tried all the js tags cant seem to get any to work.

brynFlew
Junior Poster in Training
59 posts since Jan 2011
Reputation Points: 27
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You