Dropdown List

16 views
Skip to first unread message

Milley Duke

unread,
Sep 2, 2015, 7:22:36 AM9/2/15
to rubyonra...@googlegroups.com
Hi,

When I am selecting a particular value from DropDown(values are being
populated from DB), is it possible to show the same value in dropdown.

Currently,when i am selecting any value from the dropdown the selected
value is no longer visible in the dropdown list.

Need a help as i have to complete this task asap.


Many Thanks,
Milley

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Sep 2, 2015, 7:29:40 AM9/2/15
to Ruby on Rails: Talk
On 2 September 2015 at 12:21, Milley Duke <li...@ruby-forum.com> wrote:
> Hi,
>
> When I am selecting a particular value from DropDown(values are being
> populated from DB), is it possible to show the same value in dropdown.
>
> Currently,when i am selecting any value from the dropdown the selected
> value is no longer visible in the dropdown list.

Sorry, I have no idea what you mean. Please show us the section of
code you are using to display the dropdown and explain in more detail
what is going wrong.

Colin

Milley Duke

unread,
Sep 2, 2015, 7:39:41 AM9/2/15
to rubyonra...@googlegroups.com
Hi Colin,

The query which i am using on my form is :

= f.select(:word_ids, Word.order(:text).collect {|w| [ w.text, w.id ] },
{ label: "Words" }, { multiple: true })

I am able to select a value from dropdown list of values.If i want to
select the same value again then i can't see that value in the dropdown
list anymore.

Is there any way that i can see the value in dropdown list irrespective
of how many times i have selected the value.

Also,please find attached screenshot.

Thanks,
Milley

Colin Law wrote in post #1178473:
Attachments:
http://www.ruby-forum.com/attachment/11078/Screenshot1.png
http://www.ruby-forum.com/attachment/11079/screenshot2.png

Colin Law

unread,
Sep 2, 2015, 8:53:21 AM9/2/15
to Ruby on Rails: Talk
On 2 September 2015 at 12:39, Milley Duke <li...@ruby-forum.com> wrote:
> Hi Colin,
>
> The query which i am using on my form is :
>
> = f.select(:word_ids, Word.order(:text).collect {|w| [ w.text, w.id ] },
> { label: "Words" }, { multiple: true })
>
> I am able to select a value from dropdown list of values.If i want to
> select the same value again then i can't see that value in the dropdown
> list anymore.
>
> Is there any way that i can see the value in dropdown list irrespective
> of how many times i have selected the value.
>
> Also,please find attached screenshot.

I believe that the word is still there in the list, but it is styled
so that the background and text are the same colour so you cannot see
the text. Normally the currently selected item would be highlighted.
I guess you have specified something in a stylesheet that has caused
this. In Firefox you can use Tools > Web Developer > inspector to
examine the styles.

Colin

>
> Thanks,
> Milley
>
> Colin Law wrote in post #1178473:
>> On 2 September 2015 at 12:21, Milley Duke <li...@ruby-forum.com> wrote:
>>> Hi,
>>>
>>> When I am selecting a particular value from DropDown(values are being
>>> populated from DB), is it possible to show the same value in dropdown.
>>>
>>> Currently,when i am selecting any value from the dropdown the selected
>>> value is no longer visible in the dropdown list.
>>
>> Sorry, I have no idea what you mean. Please show us the section of
>> code you are using to display the dropdown and explain in more detail
>> what is going wrong.
>>
>> Colin
>
> Attachments:
> http://www.ruby-forum.com/attachment/11078/Screenshot1.png
> http://www.ruby-forum.com/attachment/11079/screenshot2.png
>
>
> --
> Posted via http://www.ruby-forum.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 rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4528061c72158d8661ae59cf14699267%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

Milley Duke

unread,
Sep 2, 2015, 9:03:30 AM9/2/15
to rubyonra...@googlegroups.com
Hi Colin,

Thanks for the reply. By inspecting the element I am able to see the
value in dropdown however I am not able to select that value.It's always
selecting the next value when i am clicking on that value.

Also, I am not able to see the blue color background on the value which
was previously being selected that basically allows me to select value.

Thanks,
Milley

Colin Law wrote in post #1178481:
> On 2 September 2015 at 12:39, Milley Duke <li...@ruby-forum.com> wrote:
>>
>> Is there any way that i can see the value in dropdown list irrespective
>> of how many times i have selected the value.
>>
>> Also,please find attached screenshot.
>
> I believe that the word is still there in the list, but it is styled
> so that the background and text are the same colour so you cannot see
> the text. Normally the currently selected item would be highlighted.
> I guess you have specified something in a stylesheet that has caused
> this. In Firefox you can use Tools > Web Developer > inspector to
> examine the styles.
>
> Colin

Colin Law

unread,
Sep 2, 2015, 9:15:40 AM9/2/15
to Ruby on Rails: Talk
On 2 September 2015 at 14:02, Milley Duke <li...@ruby-forum.com> wrote:
> Hi Colin,
>
> Thanks for the reply. By inspecting the element I am able to see the
> value in dropdown however I am not able to select that value.It's always
> selecting the next value when i am clicking on that value.
>
> Also, I am not able to see the blue color background on the value which
> was previously being selected that basically allows me to select value.

In the screenshot the current selected item shows like a button with a
cross by it. Where is that coming from? Is there some javascript
doing it?

Colin

>
> Thanks,
> Milley
>
> Colin Law wrote in post #1178481:
>> On 2 September 2015 at 12:39, Milley Duke <li...@ruby-forum.com> wrote:
>>>
>>> Is there any way that i can see the value in dropdown list irrespective
>>> of how many times i have selected the value.
>>>
>>> Also,please find attached screenshot.
>>
>> I believe that the word is still there in the list, but it is styled
>> so that the background and text are the same colour so you cannot see
>> the text. Normally the currently selected item would be highlighted.
>> I guess you have specified something in a stylesheet that has caused
>> this. In Firefox you can use Tools > Web Developer > inspector to
>> examine the styles.
>>
>> Colin
>
> --
> Posted via http://www.ruby-forum.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 rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f51e6490ee77c6fae946b3b0489091ac%40ruby-forum.com.

Milley Duke

unread,
Sep 2, 2015, 9:27:03 AM9/2/15
to rubyonra...@googlegroups.com
Hi Colin,

Its happening through javascript.

Colin Law wrote in post #1178483:
> On 2 September 2015 at 14:02, Milley Duke <li...@ruby-forum.com> wrote:
>> Hi Colin,
>>
>> Thanks for the reply. By inspecting the element I am able to see the
>> value in dropdown however I am not able to select that value.It's always
>> selecting the next value when i am clicking on that value.
>>
>> Also, I am not able to see the blue color background on the value which
>> was previously being selected that basically allows me to select value.
>
> In the screenshot the current selected item shows like a button with a
> cross by it. Where is that coming from? Is there some javascript
> doing it?
>
> Colin

Colin Law

unread,
Sep 2, 2015, 9:29:36 AM9/2/15
to Ruby on Rails: Talk
On 2 September 2015 at 14:26, Milley Duke <li...@ruby-forum.com> wrote:
> Hi Colin,
>
> Its happening through javascript.

In that case I think it highly likely that the javascript is causing
the other problem. What happens if you disable javascript in the
browser?

Colin
> --
> 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 rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7f9545bdc10fae5fb833da72b0f82726%40ruby-forum.com.

Milley Duke

unread,
Sep 2, 2015, 9:30:07 AM9/2/15
to rubyonra...@googlegroups.com
Hi Colin,

We are using select2.js jquery plugin.

Thanks,
Milley

Milley Duke wrote in post #1178484:

Milley Duke

unread,
Sep 2, 2015, 9:32:55 AM9/2/15
to rubyonra...@googlegroups.com
Hi Colin,

By disabling javascript, the drop down is not working properly.

Thanks,
Ekta

Colin Law wrote in post #1178488:
> On 2 September 2015 at 14:26, Milley Duke <li...@ruby-forum.com> wrote:
>> Hi Colin,
>>
>> Its happening through javascript.
>
> In that case I think it highly likely that the javascript is causing
> the other problem. What happens if you disable javascript in the
> browser?
>
> Colin

Colin Law

unread,
Sep 2, 2015, 9:42:21 AM9/2/15
to Ruby on Rails: Talk
On 2 September 2015 at 14:32, Milley Duke <li...@ruby-forum.com> wrote:
> Hi Colin,
>
> By disabling javascript, the drop down is not working properly.

What do you mean, not working properly?

By the way, it would help me if you could insert your replies inline
rather than top posting as it makes it easier to follow the thread.
This is a mailing list not a forum, though you may be accessing it via
a forum-like interface. Thanks.

Colin

>
> Thanks,
> Ekta
>
> Colin Law wrote in post #1178488:
>> On 2 September 2015 at 14:26, Milley Duke <li...@ruby-forum.com> wrote:
>>> Hi Colin,
>>>
>>> Its happening through javascript.
>>
>> In that case I think it highly likely that the javascript is causing
>> the other problem. What happens if you disable javascript in the
>> browser?
>>
>> Colin
>
> --
> Posted via http://www.ruby-forum.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 rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1cfa833e15904d3e5917e91789a00dc7%40ruby-forum.com.

Milley Duke

unread,
Sep 2, 2015, 9:46:08 AM9/2/15
to rubyonra...@googlegroups.com
Colin Law wrote in post #1178491:
> On 2 September 2015 at 14:32, Milley Duke <li...@ruby-forum.com> wrote:
>> Hi Colin,
>>
>> By disabling javascript, the drop down is not working properly.
>
> What do you mean, not working properly?
>
> By the way, it would help me if you could insert your replies inline
> rather than top posting as it makes it easier to follow the thread.
> This is a mailing list not a forum, though you may be accessing it via
> a forum-like interface. Thanks.
>
> Colin

Hi Colin,

Sorry for the replying that way.Will keep this in mind in Future.

Yeah, its not working like dropdown when i am disabling javascript.

Thanks,
Milley

Colin Law

unread,
Sep 2, 2015, 9:52:52 AM9/2/15
to Ruby on Rails: Talk
A select box does not need javascript to operate. What do you see and
what happens when you click it? View the source in the browser and
copy/paste here the html code that you see for the select tag.

Colin

Milley Duke

unread,
Sep 2, 2015, 10:12:38 AM9/2/15
to rubyonra...@googlegroups.com
Colin Law wrote in post #1178493:
Hi Colin,

Thanks a lot for your help.

I am able to fix that issue.Just commented some code in javascript file
and now its working fine.

I had a word my Lead and he is saying we have to include that file in
our application as its used for other data as well.

Regards,
Reply all
Reply to author
Forward
0 new messages