Setting placeholder on input[type=hidden] and multiple select doesn't work

3,212 views
Skip to first unread message

jsut...@gmail.com

unread,
Aug 10, 2012, 7:00:11 PM8/10/12
to sel...@googlegroups.com
With Select2 3.0, the placeholder text does not show up in Chrome or Firefox. Am I doing something wrong?
test.html

stefa...@gmx.net

unread,
Aug 10, 2012, 7:09:35 PM8/10/12
to sel...@googlegroups.com, jsut...@gmail.com
Am Samstag, 11. August 2012 01:00:11 UTC+2 schrieb jsut...@gmail.com:
>

same for me ...
how to use multiple with remote data?

Igor Vaynberg

unread,
Aug 10, 2012, 7:32:05 PM8/10/12
to sel...@googlegroups.com
can you please make a jsfiddle, because placeholders are working fine
on the demo site: http://ivaynberg.github.com/select2/

it may also be jquery 1.8, try with latest 1.7

-igor

On Fri, Aug 10, 2012 at 4:00 PM, <jsut...@gmail.com> wrote:
> With Select2 3.0, the placeholder text does not show up in Chrome or Firefox. Am I doing something wrong?
>
> --
> You received this message because you are subscribed to the Google Groups "select2" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/select2/-/EvaH9Znl-JkJ.
> To post to this group, send email to sel...@googlegroups.com.
> To unsubscribe from this group, send email to select2+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/select2?hl=en.
>

stefa...@gmx.net

unread,
Aug 10, 2012, 7:44:37 PM8/10/12
to sel...@googlegroups.com
with html

<input type="hidden" id="anRe" name="qwe" value="7,14"/>

and the following parameter

$j("#anRe").select2({
placeholder: "search for ...",
minimumInputLength: 2,
multiple: true,
width: "500px",

remote an multiple is now working :-)

a small problem still exist.

when i start typing "test", the downdown box open with 5 item "test1 test2 test3 test4 test5" thats fine, now i hit the down arrow key to 2 times to move the selection from test1 to test3, but then the spinner shows up and the control reloads and shows the result again with the first item selected, so i am not able to choose any other element then the first element.

what am i doing wrong?

best regards
stefan

jsut...@gmail.com

unread,
Aug 10, 2012, 7:49:21 PM8/10/12
to sel...@googlegroups.com
http://jsfiddle.net/PysN2/

Sorry for being a bit vague, I'm using jQuery 1.7.1 (jsFiddle uses 1.7.2), and currently only part of the placeholder is displayed. I found the issue seems to be that width is set explicitly on the input element, and isn't properly resized after setting the placeholder. Line 1605 in select2.js in version 3.0.
Once I focus on the input, then blur, the placeholder displays properly.

Additional note, I don't think there are any placeholders on multiple selects attached to input[type=hidden] on the demo site.

Igor Vaynberg

unread,
Aug 10, 2012, 7:54:59 PM8/10/12
to sel...@googlegroups.com
this issue has already been fixed in the master branch:

http://jsfiddle.net/PysN2/1/

-igor
> To view this discussion on the web visit https://groups.google.com/d/msg/select2/-/bebcKiv-HxsJ.

platy...@gmail.com

unread,
Oct 18, 2012, 6:11:06 PM10/18/12
to sel...@googlegroups.com
It's still happening:
http://jsfiddle.net/platypusman/53w3v/1/

Until you click in the field, the input is not wide enough and the placeholder text gets cut off even if there is room to display it. (Screenshot attached.)

select2_placeholder_text_too_narrow.png
Reply all
Reply to author
Forward
0 new messages