aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript Autocomplete Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JavaScript Autocomplete" Watch "JavaScript Autocomplete" New topic
Author

JavaScript Autocomplete

M sallu
Ranch Hand

Joined: Dec 13, 2009
Posts: 42
I have two INPUT type="text" boxes.

First is Date and second is description.

For date I am using Jquery UI widget 'datepicker' and for description I am using jquery Autocomplete and defined some names

What I want is...If 12/25/YYYY is selected. I want to autocomplete the second text box with Cristmas and vice versa.

How can I do this with javascript?
M sallu
Ranch Hand

Joined: Dec 13, 2009
Posts: 42
I have dates and description. If the date is entered, then the description should autocomplete. Like if 12/25/yyyy is selected, then Christmas should automatically be shown?

I tried this, but its not working. Any help?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61611
    
  67

Your code would be much easier to read, and therefore more likely to generate responses, if it were properly indented.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Look at line 16 and see if you see anything missing.


GenRocket - Experts at Building Test Data
M sallu
Ranch Hand

Joined: Dec 13, 2009
Posts: 42
I tried this, its working with only one value. If I have 'else if' or 'if' for multiple values, its not working.

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Look at line 17 and tell me what's wrong, and this time, don't ignore my post.
Praison Selvaraj
Ranch Hand

Joined: Jun 05, 2010
Posts: 49
Line 17 is

[Removed possible solution. He needs to learn how to debug his code. - GDB]

Thanks,
Praison


SCJP, SCWCD, SCEA
M sallu
Ranch Hand

Joined: Dec 13, 2009
Posts: 42
Praison Selvaraj wrote:Line 17 is

[Removed possible solution. He needs to learn how to debug his code. - GDB]

Thanks,
Praison


Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Good job! Does it work now?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Why in the world are you doing this $(this).val().substring(0, 5) over and over again? You only need to do it once. Doing it over and over again will make you app slow.

Eric
M sallu
Ranch Hand

Joined: Dec 13, 2009
Posts: 42
Better script to complete description if the date is entered and date if the description is entered.

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You have so much repeated code in there that is such a waste.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript Autocomplete