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.
Unfortunately, activation email could not send to your email. Please try again.

Ability to prevent more than x characters in Grid Input Box

Thread ID:





121749 Jan 21,2016 10:11 AM Jan 25,2016 11:28 PM JavaScript 3
Tags: ejGrid
Greg Gannicott
Asked On January 21, 2016 10:11 AM


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.

Ragavee U S [Syncfusion]
Replied On January 22, 2016 02:33 AM

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 () {


            . . . .

           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





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


Ragavee U S.

Greg Gannicott
Replied On January 25, 2016 04:21 AM

Thanks for the quick response.

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


Gowthami V [Syncfusion]
Replied On January 25, 2016 11:28 PM

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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.