text boxes not showing previous entered values on double click

I have created a form having various text boxes? the form is working fine,problem point is even if i submit the 20 times with different values like h,hh,hhh,hhh,hhh1,hh2 for a single field say name. now when i double click the name or type h as value it is not showing the auto complete for the values which were entered before.

Problem is not related with browser setting as far as i can guess bcoz it is same in other browser also like IE,Firefix,chrome. Also if i see other browse other websites there is no such point.

It is only in my html,Can anybody please provide wht can be wrong?
Who is Participating?
1. Make sure you set the name attribute as well as the id attribute to the input tag

What is your name? <input name="name" id="name">

instead of

What is your name? <input id="name">

2. make sure you don't have autocomplete="off"
RockingAuthor Commented:
i am using name and id both regarding auto complete i am using html4
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Are you using ajax to submit the form? It only saves the autocomplete when you push the submit button. Here is a workaround


<form action="">
<input type="text" name="firstname" />
<input type="text" name="lastname" />
<input type="text" name="email" />
<a href="#" onclick="forceAutoComplete();ajax.send()">Send</a>

<script type="text/javascript">
function forceAutoComplete() {
var $forms = document.getElementsByTagName("FORM");
for ( var i = 0; i < $forms.length; i++ ) {
var $form = $forms[i];
var $submit = document.createElement("INPUT");
$submit.type = "submit";
$form.onsubmit = function(){return false}
$submit.style.display = "none";

Open in new window

RockingAuthor Commented:
yes i am using ajax to submit the form,Is it because of ajax why i am unable to view the previous values submitted on double clicking text box?
ajax code is

function SubmitFrm() {
                  type : 'post',
                  url : 'testsubmit',
                  data : $('#registerform').serialize(),
                  async : false,
                  dataType : "text",
                  beforeSend : function() {
                        $.blockUI({ message: '<h1><img src="../img/loading.gif" /> Processing...</h1>'});
                  complete : function() {
                  success : function(data) {
                  error : function(data) {
                        // check status && error

Yes. the autocomplete values are only stored when the form is actually submitted.
RockingAuthor Commented:
is it necessary the button type to be submit to persist the values or button type "button" is also OK ?

 It only saves the autocomplete when you push the submit button.
I think the button type is also ok, as long as its action is set to submit the form.
RockingAuthor Commented:
i applied the code provided by you but the values are not persisted,there could be any other problem
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.