I’ve worked out how to create a search form using content types and views, and I’ve worked out how to create forms inside modules.
What I really want, is a search form via forms functionality, but I want to add an extra form field in that search which utilises autocomplete using my own geographic database table (not in Drupal’s tables).
I feel a bit trapped… I can’t add a field in views, that isn’t in the content type, yet I don’t want to implement the search form in the module, as the views search form seems like the right way to do it.
So imagine a property search (property as in houses and flats), I have a Drupal content type of rented accommodation, so min rent, max rent, number of bedrooms etc. It is fairly easy to create a search form using views. However I want a location field where the user types and it autocompletes (gives them choices) of all the street names, postcodes and towns and villages. So if they typed ‘Ca’ in the location field (for where they want to live near), suggestions like ‘Cape Street, Cardiff, Campbell Road’ would all show up as suggestions (think jQuery’s autocomplete functionality).
So in short, how do I add my own autocomplete field into a views search form, where the autocomplete is using my database, and none of Drupal’s built-in data.
I have over 38,000 bits of street data, with X, Y coordinates… it felt wrong to add this to Drupal’s own database as data.