Skip to content

Forms and onSubmit help #87

Closed Answered by niketpathak
TotoroBy99 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @TotoroBy99 .

To answer your first question, the display() config option can be used. Although, you will have to make use of an additional hidden input. Here's an example:

Your html could be

<form action="...">
  <input type="search" name="superhero" class="search" autocomplete="off" placeholder="Search movies..." />
  <input type="hidden" name="superhero_id"> <!-- hidden input to store the id  -->
  <input type="text" name="address"> <!-- other unrelated inputs in your form  -->
  <button type="submit">Submit</button>
</form>

And in your JS, your typeahead configuration could be -

typeahead({
      input: document.querySelector('.search'),
      source: {
        prefetch: {

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by niketpathak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants