Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple instances of JQueryUI Autocomplete on same Pyramid page
    primarykey
    data
    text
    <p>I have a working JQueryUI Autocomplete input widget working nicely with my Pyramid backend. The autocomplete posts its <code>request.params['term']</code> to the same URL as the page its on, and Pyramid uses <code>request_param='term'</code> as a route predicate to send the term value to my database query view-callable.</p> <p>The problem I have now though, is that I need to add more autocomplete widgets to the same page. However, I can't use the same route predicate <code>term</code> because both widgets post <code>term</code> and so Pyramid doesn't know where to send the post.</p> <p>I know you can make custom predicates in Pyramid, but as far as I can see, there is nothing unique about the 2 autocomplete widgets with which I can make a custom predicate.</p> <p>To give some context, below is the route/view definition. The definition is actually illegal because Pyramid rightly refused to identical predicates, but it serves to demonstrate my dilemma:</p> <pre><code>config.add_route('search_programs','/search/programs') config.add_view( 'haystack.search.search_programs', route_name='search_programs', renderer='templates/search_programs.jinja2') config.add_view( 'haystack.search.programtype_autocomplete', route_name='search_programs', request_param='term', renderer='json') config.add_view( 'haystack.search.majorgenre_autocomplete', route_name='search_programs', request_param='term', renderer='json') </code></pre> <p>What would be awesome is if the autocomplete widget had an option to specify an arbitrary key for posting, instead of just 'term' every time. Any help would be awesome.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload