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

JQuery Checking Of Values

3 Answers 53 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 04 Feb 2011, 04:59 PM
Hello,

Often I have a form that has these values:

RadTextBox
RadNumericTextBox
RadDatePicker
RadComboBox
RadMaskedTextBox

I often use a CustomValidator control to validate the form to ensure at least one value has been provided in the form.  Rather than write code to check each an every control to see if it has a value, is there one JQuery condition I can write to check to see if any of the controls have a value?  I tried using a CSS class to identify each control, and then target that control by doing something like:

$("#wrapper").find(".TelerikControl[value != null && value != '']").length > 0

To determine if there is any value present, but this doesn't quite work.  Can anyone share if they did this and how?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 09 Feb 2011, 02:34 PM
Hello Brian,

Our controls are ASP.NET AJAX ones and you should use the client-side API. For example if you want to get RadTextBox's value, you need to get a reference to it by using $find(<RadTextBox's ClientID>) and then call its get_value() method.


Kind regards,
Georgi Tunev
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
Brian Mains
Top achievements
Rank 1
answered on 10 Feb 2011, 02:42 PM
Hello,

Yes, but if I have a small subset of controls within a tab, and I want to check if any of those are empty, I have to write code to check each and every control... which is a pain to write.  It would be nice if there was a global way to check this so I don't have to constantly write:

if (!!$find("<%= txtName.ClientID %>").get_value() || ..)

I can't use your global radcontrols collection either because I need to check a subset of the controls here.

0
Maria Ilieva
Telerik team
answered on 16 Feb 2011, 10:22 AM
Hello Brian,

Currently there is no possibility to access all RadControls on the page and apply some method to all of them. Each particular control in our suit is specific and provides different methods and properties on the client, so the same method for particular action could not be applied to all of them.
I would suggest you in your case in order to validate each control on the page, to validate the whole Page itself. You could call Page_ClientValidate() function and check to see if the validations(Custom, RequireField) are complete in the page.


All the best,

Maria Ilieva
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.
Tags
General Discussions
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Brian Mains
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or