This is a migrated thread and some comments may be shown as answers.

EmptyText property?

8 Answers 158 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Kjell asked on 27 Jan 2012, 11:26 PM
Is there an EmptyText property in the combobox like you have in the silverlight combobox?  If not, what is the best way to go about duplicating that functionality?  In the old days I would just set it and clear it in the gotfocus / onfocus events, is that how it shoud be done here or is there an easier way?

8 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 31 Jan 2012, 10:02 AM
Hello Kjell,

 
This functionality is in our TODO list and is scheduled for the next official release of Kendo UI. Currently, you can achieve your goal using focus/blur event to add/clear the text.

Kind regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kjell
Top achievements
Rank 1
answered on 08 Feb 2012, 06:01 AM
I am having trouble getting the onblur and onfocus events to fire.  Here is my input definition:

<input id="clientCombo" value="Type Client Name/Number" style="color: DarkGray" onfocus="javascript:alert('focus');" onblur="javascript:alert('blur');"/>


and the js which sets up the combobox:
$("#clientCombo").width(300).kendoComboBox()}

Neither event fires, though if I comment out the above javascript and just leave "clientCombo" as a regular input, then the alerts work fine. I tried changing the event names to "focus" and "blur" just in case your post was meant to be taken literally, but that did not work. I also tried defining the focus event in the js which sets up the combo, that didn't work but I probably wasn't doing it right:

$("#clientCombo").width(300).kendoComboBox({
       focus: alert('asdf')
 });

0
Georgi Krustev
Telerik team
answered on 09 Feb 2012, 11:59 AM
Hello Kjell,

 
After create ComboBox widget from input element, it will be hidden. You will need to wire the focus/blur event of the visible input element. Here how you can get the visible input:

var combo = $("#clientCombo").width(300).kendoComboBox().data("kendoComboBox");
var visibleInput = combo.input;

Setting the width of the input element works fine on my end. Check this jsFiddle demo.

Greetings,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kjell
Top achievements
Rank 1
answered on 21 Feb 2012, 08:46 PM
Can you add the visibleinput part to your example?  When I tried it, "visibleInput" was undefined. All I need is something really basic like just have it change the color of the text on blur or focus for example. 
0
Accepted
Georgi Krustev
Telerik team
answered on 22 Feb 2012, 03:47 PM
Hi,

 
Here is a simple jsFiddle demo, which shows how to wire the focus/blur event of the visible input. Let me know if other questions arise.

Kind regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kjell
Top achievements
Rank 1
answered on 22 Feb 2012, 09:51 PM
Thanks, that's exactly what I needed.
0
Trent Jones
Top achievements
Rank 1
answered on 23 Jul 2012, 03:44 PM
Is this feature now included in the code.  I can't find any documentation about it?
0
Georgi Krustev
Telerik team
answered on 24 Jul 2012, 07:27 AM
Hello,

 
I will suggest you check the placeholder property of the Combobox.

All the best,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ComboBox
Asked by
Kjell
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Kjell
Top achievements
Rank 1
Trent Jones
Top achievements
Rank 1
Share this question
or