JQuery Checking Of Values

4 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 04 Feb 2011 Link to this post

    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.
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 09 Feb 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 10 Feb 2011 Link to this post

    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.

  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 16 Feb 2011 Link to this post

    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.
Back to Top