We help IT Professionals succeed at work.

Autofill With Alternative Value

davecestria asked
Last Modified: 2008-02-01
Hello experts,

I have just had a similar question answered at https://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21744969.html but this one is a little more confusing to me because i am using an auto-complete script to match the drivers.

I think the easiest thing for me to do is allow you to view the page.

The drivers names are loaded into a hidden form list item, then using an autofil script completes the names. "Dave Gibson & Andy Crisp" present at the moment.

I would like it if when the Driver1 or Driver2 names are matched up to one in the list it loads the altValue (contact number) from the hidden drivers list and puts it into the Contact text box.

I would like the original number to stay in the contact box, for example if driver1 and driver2 both contain contact numbers the first name with a number will be displayed. But if driver1 contains no number and driver2 does obviously i would like driver2's number to be added to the contact text box.

Any questions needed please ask, im here for another 3 hours.

Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)



Thanks for your help, nearly there. I added a new name, 'Dave Smith' to the list.

When i start typing Dave the initial name that comes up is Dave Gibson, but if i carry on typing to make it Dave Smith the number still remains Dave Gibson's, is there a way to get round this?



Are you resetting the index to -1, let me know if this makes a difference if not i will have to take another look at it later. Anther idea just for debugging purposes is to show (not hide) the select box were the system is getting the values from so that you can see if it is resting the value or not.  

// objSelect.selectedIndex = -1;   << uncomment this line


It's ok mate, i got it.

Used onBlur to execute the getContactNumber function, works fine :)

Thanks again.

Great help.


Good luck with it then, hope it all turns out.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.