Link to home
Start Free TrialLog in
Avatar of davecestria
davecestria

asked on

Autofill With Alternative Value

Hello experts,

I have just had a similar question answered at https://www.experts-exchange.com/questions/21744969/Prefix-On-Contract-Selection.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.
http://www.cestriadistribution.com/cdsm/routes/create.asp

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.

Dave
ASKER CERTIFIED SOLUTION
Avatar of CVSmarc
CVSmarc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of davecestria
davecestria

ASKER

Hello,

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?

Thanks,


Dave
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.  
ant

// 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.

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