0

I have one simple question. I have a search box in which the box used datalist. When user input some alphabet it will show the possibility of the word. The problem is when user click on the possible result displayed. The form worked fine because the data is submitted. When the page refresh (submit form), the textbox is blank. It does not show the option clicked by user earlier. I would like to make it displayed on textbox whenever user click the option. For example, user click Opera, after the form submit, it still display Opera on the text box.

  <input list="browsers" name="browser">
      <datalist id="browsers">
        <option value="Internet Explorer">
        <option value="Firefox">
        <option value="Chrome">
        <option value="Opera">
        <option value="Safari">
      </datalist>
hud.
  • 160
  • 1
  • 14
  • should work – Anil Mar 01 '17 at 08:01
  • Thee is an error. ASP.NET attributes are only allowed in ASP.NET files. – hud. Mar 01 '17 at 08:04
  • My bad, its mvc, use a hidden field and javascript/jquery to populate this before submit and again on load, another option utilize view model http://stackoverflow.com/questions/11064316/what-is-viewmodel-in-mvc – Anil Mar 01 '17 at 08:09
  • I am not sure if using hidden field is the best solution. btw thanks for your idea – hud. Mar 02 '17 at 02:40

0 Answers0