Solved

text boxes not showing previous entered values on double click

Posted on 2014-03-22
9
810 Views
Last Modified: 2014-03-28
Hi,
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?
0
Comment
Question by:Rocking
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 24

Expert Comment

by:mankowitz
ID: 39948158
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"
0
 

Author Comment

by:Rocking
ID: 39948462
i am using name and id both regarding auto complete i am using html4
0
 
LVL 24

Expert Comment

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

http://www.kirupa.com/forum/showthread.php?346632-Force-auto-complete-on-form-fields

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

<script type="text/javascript">
//<![CDATA[
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.appendChild($submit);
$form.onsubmit = function(){return false}
$submit.style.display = "none";
$submit.click();
}
}
//]]>

Open in new window

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:Rocking
ID: 39948792
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() {
       {
            $.ajax({
                  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() {
                        $.unblockUI();
                  },
                  success : function(data) {
                  $.unblockUI();
                        alert(data);
                        
                  },
                  error : function(data) {
                        // check status && error
                  }

            });
      }
0
 
LVL 24

Expert Comment

by:mankowitz
ID: 39950132
Yes. the autocomplete values are only stored when the form is actually submitted.
0
 

Author Comment

by:Rocking
ID: 39950803
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.
0
 
LVL 24

Expert Comment

by:mankowitz
ID: 39952092
I think the button type is also ok, as long as its action is set to submit the form.
0
 

Author Comment

by:Rocking
ID: 39956415
i applied the code provided by you but the values are not persisted,there could be any other problem
0
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 39960691
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question