
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Integrate with jQuery UI autocomplete library to provide select by autocomplete input and form helper.
Add this line to your application's Gemfile:
gem 'autocomplete_select'
And then execute:
bundle
Or install it yourself as:
gem install autocomplete_select
Make sure you required jQuery, jQuery UI and add the following to /app/assets/javascripts/application.js:
//= require autocomplete_select
Make sure you required jQuery UI css.
You have to implement a controller and action like this
class UsersController < ActionController::Base
def search
term = params[:term]
users = User.where("name LIKE ?", "%#{term}%")
render :json => users.map{ |user| {:value => user.id, :label => user.name}}
end
end
The input term
is what you type in textbox.
The output must be an array with value
and label
.
You can use autocomplete_select_tag
and autocomplete_select
.
<%= autocomplete_select_tag(name, search_path, value, autocomplete_options, html_options) %>
<%= autocomplete_select_tag(name, search_path, value, display, autocomplete_options, html_options) %>
<%= autocomplete_select_tag(:user_id, search_users_path, 1, 'username', {:minLength => 3}, {:class => 'user'}) %>
<%= autocomplete_select_tag(:user_id, search_users_path, 1, 'username') %>
<%= autocomplete_select_tag(:user_id, search_users_path) %>
or form builder
<% form_for @item do |f| %>
<%= f.autocomplete_select(method, search_path, autocomplete_options, html_options) %>
<%= f.autocomplete_select(method, search_path, display, autocomplete_options, html_options) %>
<%= f.autocomplete_select(:user_id, search_users_path, 'username', {:minLength => 3}, {:class => 'user'}) %>
<%= f.autocomplete_select(:user_id, search_users_path, 'username') %>
<%= f.autocomplete_select(:user_id, search_users_path) %>
<% end %>
The gem is available as open source under the terms of the MIT License.
The project's website is located at https://github.com/emn178/autocomplete_select
Author: Chen, Yi-Cyuan (emn178@gmail.com)
FAQs
Unknown package
We found that autocomplete_select demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.