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

ComboBox jQuery Validation not working with "Empty Message" attribute set

1 Answer 160 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mohamed
Top achievements
Rank 1
Mohamed asked on 04 May 2013, 10:42 PM
I have a similar issue to the one mentioned at:
http://www.telerik.com/community/forums/aspnet-ajax/combobox/jquery-validation-and-radcombobox.aspx

The solution provided is working well unless I set a value for the ComboBox "Empty Message" attribute, i.e, the message that appears within the ComboBox to tell the user to select a value.

Any solution?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 May 2013, 08:32 AM
Hi Mohamed,

Please have a look at the following code I tried without giving any Default Item which works fine at my end.

ASPX:
<form runat="server" id="myForm1" method="get" action="">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
    <label for="text1">
        Enter Text</label>
    <input type="text" id="text1" class="required" />
    <br />
    <br />
    <label for="RadComboBox1">
        RadComboBox</label>
    <telerik:RadComboBox ID="RadComboBox1" runat="server" EnableLoadOnDemand="true" OnItemsRequested="RadComboBox1_ItemsRequested">
    </telerik:RadComboBox>
    <br />
    <br />
    <input id="Submit1" class="submit" type="submit" value="Submit" runat="server" />
</div>
</form>

JavaScript:
<script type="text/javascript" src="../jquery/jquery-1.4.2.js"></script>
<script type="text/javascript" src="../jquery-validate/jquery.validate.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
 
        $("#myForm1").validate();
 
        $(".rcbInput").rules("add", {
            required: true,
            minlength: 2,
            messages: {
                required: "Select an Item"
            }
        });
 
        $(".rcbInput").validate();
 
    });
</script>

CSS:
<style type="text/css">
    label.error
    {
        color: red;
    }
</style>

Thanks,
Princy.
Tags
ComboBox
Asked by
Mohamed
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or