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

Invalid state

2 Answers 116 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jerome
Top achievements
Rank 1
Jerome asked on 02 Dec 2011, 06:37 PM
Is there anyway to set the RadComboBox into an invalid state, like RadInput? I'd like a similar rendering mode, with a little yellow warning sign, and such.

2 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 07 Dec 2011, 03:42 PM
Hi Jerome,

The desired behavior is not a built-in functionality of the RadComboBox. A similar scenario, however, could be achieved with JavaScript / jQuery.

The following code-block shows such a functionality. On RadComboBox's blur it checks if there is an item which text equals the text typed in the input filed, in case such an item is not found, a caution sigh shows on its right side:
function clientBlur(sender, args)
{
    var text = sender.get_text();
    var item = sender.findItemByText(text);
    var input = sender.get_inputDomElement();
    if (item == null)
    {              
        input.style.background = "URL('Images/caution.png') top right no-repeat";
    } else
    {
        input.style.background = "";
    }
}
<telerik:RadComboBox ID="RadComboBox1" runat="server" AllowCustomText="true" OnClientBlur="clientBlur">
    <Items>
        <telerik:RadComboBoxItem runat="server" Text="item1" />
        <telerik:RadComboBoxItem runat="server" Text="item2" />
        <telerik:RadComboBoxItem runat="server" Text="item3" />
    </Items>
</telerik:RadComboBox>

I hope this helps.

All the best,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Jerome
Top achievements
Rank 1
answered on 07 Dec 2011, 05:07 PM
Figured as much.

So, I think it'd be awesome if ya'll were to add this. And of course, add the default styles for such into the built-in themes. Red border, etc.

Tags
ComboBox
Asked by
Jerome
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Jerome
Top achievements
Rank 1
Share this question
or