How to auto-advance cursor to next input box (html within php)

1975 pts.
Tags:
HTML
PHP
I see web sites that do this, but I suspect they use Javascript. I want to have this feature but keep it within a php program. I do use Javascript for onclick stuff but I don't want to mix it in with core functionality (then it's no longer a php program but rather a combination program). Since I hope to use my current program as a model for many future programs, structure is very important to me here. If it matters, I primarily write RPGLE, so I often trip over things that seem obvious to a native web programmer.

Software/Hardware used:
as400

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Please define "auto-advance". Does that mean that you want to control which input field on a form is next? Do you simply want to have the cursor jump to the next field when the last character is typed into the current input field? Is this a 'tab' question? Or is this a "record auto-advance" that you're asking about? . A little clarification could be helpful. . Tom
    125,585 pointsBadges:
    report
  • aceofdelts
    I'd like door number 2 please - Cursor to jump to the next field after final character of current field is typed. Probably doesn't matter but I only want to do this for certain fields (so not 'global' via style sheet if that were an option). TMI - a good example is the phone number which is split into multiple fields ... very natural to be able to merely type all digits and they end up in the proper spots.
    1,975 pointsBadges:
    report
  • TomLiotta
    I don't know that it can be done in php, though javascript could do it on at least later versions of some browsers. . There is the 'onkeyup' HTML event that can trigger a javascript function that can test whether the input has reached its size limit or not; and that gives the opportunity to choose to give focus to another input field. But there are complications that arise when tabbing or back-tabbing into the field for corrections. And code may get complicated for different versions of different browsers. . A number of opinions go against such code. Let the user do it, particularly when it starts complicating code. . It might be best just to have a single field that accepts up to ten characters (or 12 or whatver) and you validate a phone number format after entry. . There are examples of javascript functions if you want to try them. Search Google for [ javascript Auto-advance in form fields site:stackoverflow.com ] and [ jquery Automatically advance to next field in HTML form without changing tab behaviour site:stackoverflow.com ]. Discussions around those help illustrate some complications and potential resolutions. . Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following