0

I have a form that looks like:

<form id="search-form" action="about:blank" target="none">
  <input type="text" id="search-text">
  <button id="search-submit"> Go! </button>
</form>
<iframe name="none" style="display:none"></iframe>

While I don't want my form to update the page, yet I want autocomplete to work properly so I send a blank page to the iframe every time the form is submitted.

Will this solution work on every browser? (Or should I create a "/blank" blank page response on the server...)

Barney Szabolcs
  • 11,846
  • 12
  • 66
  • 91
  • What does the autocomplete require to work properly? Would it work to prevent submission of the form altogether? – showdev Dec 05 '13 at 22:09
  • 3
    You probably should go with an AJAX solution here, not an iframe. – Joe Enos Dec 05 '13 at 22:09
  • @JoeEnos I go with ajax, but you know there's a built-in autocomplete in the browsers that just works fine with me... – Barney Szabolcs Dec 05 '13 at 23:38
  • @showdev I have tried that but then the browser will not remember the input in its autocomplete. – Barney Szabolcs Dec 05 '13 at 23:40
  • I assume you're referring the browser's native autocomplete functionality. You may have already seen this post, but the accepted answer seems to use a method similar to yours: [Trigger autocomplete without submitting a form](http://stackoverflow.com/questions/15462991/trigger-autocomplete-without-submitting-a-form) – showdev Dec 05 '13 at 23:49

0 Answers0