We help IT Professionals succeed at work.
Get Started

Form submission and jQuery autocomplete

dkim18
dkim18 asked
on
235 Views
Last Modified: 2015-06-17
Hi Experts,

I have created a jQuery autocomplete for certain page and it worked fine if I reach the page from a link in previous page.
However, if I reach the page with autocomplete text field from form submit, the autocomplete doesn't work.

I will show example in the following:

This is autocomplete part:
<script type="text/javascript">
	
	$(document).ready(function() {
    $(function() {        	
    	
        $("#diagtags").autocomplete({
        	minLength: 3, //at leat 3 char required        	
            source: function (request, response) {
                $.getJSON("AutoCompleteController", {
                    term: request.term
                }, response);
            }          
        });              
    });
	});
</script>
...
...
...
 <input type="text" name="test" id="diagtags" >

Open in new window


=========================
If I go the automplete page from this link, it works ok.
<a href="/xxx/abcEdit.do?method=edit">Add New</a>

===================================
however, if I reach the autocomplete page from form submission, the autocomplete text field doesn't display anything when I type in something(more than 3 characters.)
<form name="AbcForm" method="post" action="/xxx/xxx/cde.do" >  
	<input type="submit" name="method" value="Add">			
</form>

Open in new window



What is that and what is the solution for this?

Thanks in advance
Comment
Watch Question
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
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
Ask ANY Question

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

  • Troubleshooting
  • Research
  • Professional Opinions
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