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

Validation of textarea

2 Answers 605 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Henning
Top achievements
Rank 1
Henning asked on 09 Sep 2012, 01:59 PM
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 Answers, 1 is accepted

Sort by
0
umesh
Top achievements
Rank 1
answered on 10 Sep 2012, 05:52 AM
I AM FACING SAME PROBLEM. GIVE ME ANY SOLUTION. THANKS IN ADV.
0
Mk
Top achievements
Rank 1
answered on 12 Sep 2012, 07:18 AM
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
Tags
Validation
Asked by
Henning
Top achievements
Rank 1
Answers by
umesh
Top achievements
Rank 1
Mk
Top achievements
Rank 1
Share this question
or