Validate a div element

4 posts, 0 answers
  1. Matt
    Matt avatar
    43 posts
    Member since:
    May 2013

    Posted 17 Dec 2013 Link to this post

    I have a two boxes that were previously input elements and are now inline html editors. Can any other element that are not a 'input' element be added onto the validator's list of things to check. The use is in a list view. Or would the only solution be having some hidden elements?
    1.<div class="WebDescriptionEditor" data-bind="value: WebDescription" data-role="editor"
    2.   contentEditable="true"
    3.   data-tools="['bold','italic','underline','strikethrough']">
    Thats basically it. The work around i have otherwise is to include a hidden input element after each of the the divs as so:
    1.<input type="hidden" name="WebDescription" data-bind="value: WebDescription" />
    Then the custom validation on the datasource iterates through the input elements and validates the above. Any way to skip having the extra html?

  2. Alexander Popov
    Alexander Popov avatar
    1444 posts

    Posted 19 Dec 2013 Link to this post

    Hi Matt,

    Yes, validating div elements is possible using the Validator's validateInput method, as shown in this small example.

    Alexander Popov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. HaBo
    HaBo avatar
    34 posts
    Member since:
    Oct 2011

    Posted 07 Dec 2017 in reply to Alexander Popov Link to this post

    I am trying to validate current tab on selection of other tab and prevent tab active if current tab validation is not passing.

    Here is my code, validation is always coming true

    onSelect: function (e) {
                    var container = $("#work-add-edit-form");
                    var validator = $("#work-add-edit-form").kendoValidator().data("kendoValidator");
                    //var tabStrip = $("#work-add-edit-tabstrip").data("kendoTabStrip");
                    //var currentActiveTab =;
                    //var contentId = currentActiveTab[0].getAttribute("aria-controls");
                    if (!validator.validateInput($(".k-tabstrip .k-content.k-state-active"))) {
  4. Joana
    Joana avatar
    210 posts

    Posted 11 Dec 2017 Link to this post

    Hi Harsha,

    I have prepared a sample dojo based on your requirements and code: The code you have provided looks good. Make sure that the validation attributes and the selector for the input that is to be validated are correct.

    Let me know if I have missed something in your scenario. You could update the dojo sample to match your case and send it back to us for examination.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top