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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Ability to prevent more than x characters in Grid Input Box

Thread ID:

Created:

Updated:

Platform:

Replies:

121749 Jan 21,2016 03:11 PM UTC Jan 26,2016 04:28 AM UTC JavaScript 3
loading
Tags: ejGrid
Greg Gannicott
Asked On January 21, 2016 03:11 PM UTC

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.

Ragavee U S [Syncfusion]
Replied On 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.

Greg Gannicott
Replied On January 25, 2016 09:21 AM UTC

Thanks for the quick response.

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

Cheers.

Gowthami V [Syncfusion]
Replied On 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.

CONFIRMATION

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.

Warning Icon 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.Close Icon

;