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

Jquery validation and RadCombobox

9 Answers 250 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
pnr
Top achievements
Rank 1
pnr asked on 16 Mar 2010, 08:12 AM
I am using Jquery validation (http://docs.jquery.com/Plugins/Validation) on my site, but i can't make it validate my RadCombobox's. Could you show me how that can be done?

Thanks in advance!

9 Answers, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 19 Mar 2010, 01:18 PM
Hi pnr,

To validate the input of the RadComboBox you can use the rules feature explained in the JQuery online documentation.

<script type="text/javascript">
  
    $(document).ready(function() {
  
        $("#commentForm").validate();
  
        $(".rcbInput").rules("add", {
            required: true,
            minlength: 2,
            messages: {
                required: "Please select"
            }
        });
  
        $(".rcbInput").validate();
  
    });
</script>

More details you can find at the sample project attached.

Kind regards,
Kalina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
pnr
Top achievements
Rank 1
answered on 20 Mar 2010, 03:31 PM
Hi Kalina

Thank you very much for your answer! I have a little problem with your demo, when i add 2 RadComboBoxes it only validate the first that occur. Why is that?

Thanks in advance!
 
0
Kalina
Telerik team
answered on 23 Mar 2010, 10:51 AM
Hi pnr,

In fact the JQuery class selector gets an array of elements with the specific class applied.
So you can assign the validation rule array elements using each() function:
 
<script type="text/javascript">
 
    $(document).ready(function() {
        $("#commentForm").validate();
        $(".rcbInput").each(function() {
            $(this).rules("add", {
                required: true,
                minlength: 2,
                messages: {
                    required: "Please select"
                }
            });
        });
        $(".rcbInput").validate();
 
    });
     
</script>

More details you can find at the sample page attached.

Best wishes,
Kalina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
pnr
Top achievements
Rank 1
answered on 23 Mar 2010, 11:03 AM
Thank you very much for the excellent help!
0
Anup
Top achievements
Rank 1
answered on 19 Apr 2011, 11:44 AM
The solution provided does not seem to work when the radcombo is contained in an ascx file.
In my case I also have twon instances of the same ascx on a page. Any help will be highly appriciated.

Regards
0
Kalina
Telerik team
answered on 21 Apr 2011, 11:48 AM
Hi,

On my side the solution works properly when RadComboBox is nested within a user control.
Please find more details at the sample attached.

Greetings,
Kalina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Anup
Top achievements
Rank 1
answered on 21 Apr 2011, 11:52 AM
Hi Kalina

Thanks for this solution. well on our end we had master pages being used and the same ascx was nested twice into a page. We finally decided to not use the jquery validation and stuck to; out of the box Asp.net validators. It works fine now.

thanks a lot for your effort. We really appriciate it.

Regards
0
Neehar
Top achievements
Rank 2
answered on 06 Dec 2012, 05:17 AM
Hi,
I have applied validation for RadCombo Box but the error message is displayed below the 
combobox, but i need to display error message right side of radcombobox,
please help me ,

Thank You.
0
Princy
Top achievements
Rank 2
answered on 06 May 2013, 09:16 AM
Hi Neehar,

Please check the following CSS.

CSS:
<style type="text/css">
    label.error
    {
        color: red;
        margin-left: 40px;
        position: fixed;
    }
</style>

Thanks,
Princy.
Tags
ComboBox
Asked by
pnr
Top achievements
Rank 1
Answers by
Kalina
Telerik team
pnr
Top achievements
Rank 1
Anup
Top achievements
Rank 1
Neehar
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or