We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Ability to prevent more than x characters in Grid Input Box

Hi.

Is it possible to prevent the user from entering more than x number of characters into an input box which is part of a Grid?

We're able to have a validation message display if the user breaches the limit, but we'd like to prevent the input in the first place.

Is that possible, and if not could we request that it becomes a feature please?

Many thanks.

3 Replies

RU Ragavee U S Syncfusion Team January 22, 2016 07:33 AM UTC

Hi Greg,

Thanks for contacting Syncfusion support.

We have created a sample to achieve your requirement, which can be downloaded from the below location.

Sample Link: http://jsplayground.syncfusion.com/pxnuomy3

In the above sample, we have bound the maxlength attribute to the CustomerID input text box in the actionComplete event of the Grid when the requestType is “beginedit” or “add”. Please refer to the below code example.

<script type="text/javascript">

    $(function () {


        $("#Grid").ejGrid({

            . . . .

           actionComplete: function(args){

                if(args.requestType == "beginedit" || args.requestType == "add"){

                    $("#"+this._id+"CustomerID").attr("maxlength",5);//preventing the number of characters by binding maxlength attribute to input box

                }

            }

        });

    });
</script>


Please refer to the below link for various attributes supported by input tag.

http://www.w3schools.com/tags/tag_input.asp

Regards,
Ragavee U S.


GG Greg Gannicott January 25, 2016 09:21 AM UTC

Thanks for the quick response.

We'll give that a try the next chance we get.

Cheers.


GV Gowthami V Syncfusion Team January 26, 2016 04:28 AM UTC

Hi Greg,
 
Try the solution and get back to us if you need further assistance.
 
Thanks & Regards,
 
Gowthami V.

Loader.
Live Chat Icon For mobile
Up arrow icon