Validation of textarea

3 posts, 0 answers
  1. Henning
    Henning avatar
    3 posts
    Member since:
    Jul 2012

    Posted 09 Sep 2012 Link to this post

    I'm trying to validate a <textarea>. Is it even possible to validate any other fields beside inputs? The documentation (http://docs.kendoui.com/api/framework/validator neither http://docs.kendoui.com/getting-started/framework/validator/overview) does not say anything about this.
    If <textarea> is not support, how can I achieve validation of multiline text inputs with <input>?

    Thx!

    Henning
  2. umesh
    umesh avatar
    2 posts
    Member since:
    Sep 2012

    Posted 10 Sep 2012 Link to this post

    I AM FACING SAME PROBLEM. GIVE ME ANY SOLUTION. THANKS IN ADV.
  3. Kendo UI is VS 2017 Ready
  4. Mk
    Mk avatar
    12 posts
    Member since:
    Aug 2012

    Posted 12 Sep 2012 Link to this post

    Try This

    <script type="text/javascript">
        $(document).ready(function () {
            var validator = $("#tickets").kendoValidator().data("kendoValidator");


            $("button").click(function () {
                if (validator.validate()) {
                    alert("Success");
                } else {
                    alert("all fields Required");
                }
            });


            $("#email").kendoEditor();


            $("span.k-dropdown").focusout(function () {
                validator.validate();
            });
        });
    </script>
    <div id="tickets">
        <div>
            <ul>
                <li><span class="k-invalid-msg" data-for="address"></span></li>
            </ul>
            <ul style="margin: 6px 5px 1px -87px !important;">
                <li>
                    <label for="address" class="required">
                        Address</label>
                    <textarea type="address" id="email" name="Email" style="width: 80% ! important" class="k-textbox"
                        placeholder="e.g. myname@example.net" required validationmessage="Email Required"></textarea>
                </li>
                <li class="accept">
                    <button class="k-button" type="submit">
                        Submit</button>
                </li>
                <p class="status">
                </p>
            </ul>
        </div>
    </div>
    <style>
        .k-textbox
        {
            width: 11.8em;
        }
        
        #tickets
        {
            width: 510px;
            height: 323px;
            margin: 30px auto;
            padding: 10px 20px 20px 170px;
        }
        
        #tickets h3
        {
            font-weight: normal;
            font-size: 1.4em;
            border-bottom: 1px solid #ccc;
        }
        .k-invalid-msg
        {
            font-weight: bold !important;
            font-size: 12px !important;
        }
        #tickets ul
        {
            list-style-type: none;
            margin: 0;
            padding: 0;
        }
        #tickets li
        {
            margin: 10px 0 0 0;
        }
        
        
        
        .required
        {
            font-weight: bold;
        }
        
        .accept, .status
        {
            padding-left: 90px;
        }
        
        .valid
        {
            color: green;
        }
        
        .invalid
        {
            color: red;
        }
        span.k-tooltip
        {
            margin-left: 6px;
        }
    </style>


    Hope This work
Back to Top