On Nov 7, 2015, at 3:48 PM, Deepak Sharma <[email protected]> wrote:

> In my application I have a drop-down, I want to input a value in a text-field 
> and while inputting it the drop-down should display the option for 
> auto-completing it. Following is the code snippet
> 
> <div class="field">
>   <%= f.label :patient_id %><br>
>   <%= f.collection_select(:patient_id, Patient.all, :id, :patient_identity, 
> {:prompt => "Select patient"}, :selected => @vital.patient_id, required: 
> true) %>
> </div>
> 
> In the above code I have the drop-down that display all the option. What 
> changes or what tag should I have to use input-text field and it's 
> auto-complete feature.
> 

I've had a lot of luck adding the Chosen JavaScript to an existing picking 
list. Strictly speaking, it's not an auto-complete in the classical Ajax sense, 
because all of the options are already in the page, you're not making 
background requests to search for options. https://github.com/harvesthq/chosen/

Walter


> -- 
> Cheers!
> 
> Deepak Kumar Sharma
> Guru Nanak Dev Engineering College
> India!
> 
> Blog: http://deekysharma.wordpress.com
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/CALDHwN6AtoMSH3qGd84zrFhyEFZjqNTo9jF89P6MKoGGuX6swQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/F1E1F415-DEF9-463B-B346-76D6E4604722%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to