Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6943847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:12:34+00:00 2026-05-27T13:12:34+00:00

I am dynamically generating a form. For simplicity’s sake assume it’s a login form

  • 0

I am dynamically generating a form. For simplicity’s sake assume it’s a login form with email/password. The form is submitted, but onsubmit it fires an AJAX request that handles the actual login and the submit event is cancelled (e.preventDefault()).

I use e.preventDefault() to cancel the default action of the form, that is, go to the page in ‘action’ but this also seems to cancel the autocomplete detection of the browser.

I think you need to fullfill several requirements for the native autocomplete to work:

  • Your input field type="text" must have a name
  • The form must be submitted <– this isn’t really happening in my case

Is my analysis correct and is there any way to make autocomplete work in this case?


To ward off the fanboys: I’m not looking for any solution that involves jQuery or [insert your framework], I want to use the native browser autocomplete feature. I don’t have a list of words that I want to autocomplete with.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:12:35+00:00Added an answer on May 27, 2026 at 1:12 pm

    DMoses solution greatly inspired my solution but it there is a significant difference so I thought it would be a good idea to make my own solution, the bounty goes to DMoses though 😛

    DMoses solution moves (or copies) the form to the iframe and then submits it. The reason you want to do this is so your ‘parent’ from doesn’t reload. There is a simpler solution: have the form submit to the iframe. This works just the same and you don’t have to copy any nodes.

    This step is entirely repeatable as well. The only downside is that you don’t control when exactly an autocomplete entry is added. You might want to add only valid entries but at least this case mimics perfectly the way a normal form would behave if no ajax were involved. If you want to control what gets added to the autocomplete, use DMoses’ solution, copy the form and submit it in the iframe.

    For me, this is enough:

    <form onsubmit="return ajaxit();" autocomplete="on" target="the_iframe">
        <input id="foo" name="foo"/> 
        <input type="submit" />
    </form>
    <iframe id="the_iframe" name="the_iframe" src="javascript:false"></iframe> <!-- you'll want this hidden -->
    

    The best part: no extra JavaScript is required to make this work! (other than generating a unique id/name for the form, but that’s super trivial).

    jsFiddle: http://jsfiddle.net/KzF6s/13/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A very general question. I am dynamically generating a form that is split into
I am dynamically generating the form based on the drop down selected. The form
I'm dynamically generating a Windows Forms form by reading an XML file. (Actually I
I have a dynamically generated form that I would like to submit using Ajax.
I am dynamicaly generating a HTML form that is being submitted to a .aspx
I am dynamically generating rows of a table from the ajax response I am
This seems really simple, but for some reason Im stumped.. Im dynamically generating an
i'm dynamically generating asp controls inside an update panel on a certain trigger. However,
So, I have JQuery dynamically generating controls. The input controls are called EnterLink +
Thanks for reading this. I am dynamically generating some data which includes a select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.